method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5eb9e651-4140-4e36-8539-93e598209d14
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); sb = new StringBuilder(); String line = in.readLine(); for ( ; line!=null; ) { int n = Integer.parseInt(line); if(n==0)break; vAx = new ArrayList<Integer>(); vAy = new ...
49d8fa90-f745-4eea-ad9a-f11e61877fb4
9
protected synchronized void deliverObserverEvents( Vector<TSEvent> _eventList, boolean snapshot) { String tsEventLog = null; if (_eventList == null) return; int metaCode; int cause; if (snapshot) { metaCode = 135; cause = 110; } else { metaCode = 136; cause = 100; } int nextMetaEventI...
cee2b2e8-bd63-4513-acbe-78bf06c627f8
4
public float nextRatio() { float u, v, x, xx; do { // u and v are two uniformly-distributed random values // in [0, 1), and u != 0. while ((u = gen.nextFloat()) == 0); // try again if 0 v = gen.nextFloat(); float y = C1*(v - 0.5f)...
bd1b2b3e-ba3f-48e3-8162-6d8f41444aea
1
@Override public void invalidateLayout(Container target) { for (PrecisionLayoutData one : mConstraints.values()) { one.clearCache(); } }
07d9b5c9-2018-4d91-a5ca-f7458f83bbdb
4
private void computeGridCountAndCentroids(HashMap<ArrayList<Integer>, Integer> data) { // create the number of grid for each dimension dimSize = new int[numDimension]; // the number of grids for each dimension for (int i=0; i<numDimension; i++) { int rangeDimension = maxList[i] - minList[i]; dimSize[i] = ra...
f3fe6ae3-8308-40c2-ad0f-9c59ae21d13e
0
public void desconectar(){ connection = null; }
cae1ffc2-6a25-429c-a22c-182f3d92e358
3
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); f...
654dbb37-cd3d-43db-917f-fa5c8592f861
3
public static void createLocalDatabaseAndUser(MySQLIdentity root, MySQLIdentity newIdentity) throws SQLException, MySQLException { if((root.host == null) || (newIdentity.host == null)) { throw new MySQLException("Host not specified");} if(root.host.equals(newIdentity.host) == false) { throw new MySQLException("Hos...
0604f5b2-dd02-450f-8588-48776b7301d0
2
public static void main(String[] args) { long start = System.currentTimeMillis(); try { ObjectInputStream inputFile = new ObjectInputStream( new FileInputStream("myBInaryIntegers.dat")); for (int i = 1; i <= 1000000; i++){ int tempInt = inputFile.readInt(); System.out.println(t...
4a411514-7e51-4951-b63b-992be070b1ed
8
public int[] searchRange(int[] A, int target) { int mid = 0; int start = 0, end = A.length - 1; int[] index = { -1, -1 }; boolean flag = true; while (start <= end) { mid = (start + end) >> 1; if (A[mid] == target) { flag = false; break; } if (A[mid] > target) end = mid - 1; else ...
92459fa1-bafe-4bd2-adbb-d7a145b2a7f6
1
@Override protected void setBounds(Rectangle bounds) { super.setBounds(bounds); map = new Tile[bounds.height][bounds.width]; // Tile instance properties is null when this method is called from // the constructor of MapLayer if (tileInstanceProperties != null) { t...
5212da9f-86f4-44f0-9725-cb0af127f7a7
9
public void helper(BoggleBoard board, int r, int c, ArrayList<BoardCell> list, StringBuilder searchWord, ILexicon lex) { if(r < 0 || r>= board.size() || c < 0 || c >= board.size()) { return; } BoardCell init = new BoardCell(r,c); if(list.contains(init)) { return; } String letterHere = board.getF...
38b86a11-dcb2-4160-baf7-0a6ee70e0882
3
static void preprocess(char[] p) { int i = 0, j = -1, m = p.length; b = new int[p.length + 1]; b[0] = -1; while (i < m) { while (j >= 0 && p[i] != p[j]) j = b[j]; b[++i] = ++j; } }
e79d7e2b-d5b1-4403-a990-a58ed95ed578
0
public static void main(String[] args) { MainWindowModel mainWindowModel = new MainWindowModel(); MainWindowView mainWindowView = new MainWindowView(); InterpolatorModel interpolatorModel = new InterpolatorModel(); PlotBuilder plotBuilder = new PlotBuilder(); plotBuilder.setInte...
b09a20fa-10c9-4a7a-9c43-e0e4e2915db7
2
public AutoTotaalDienst getATD() { ArrayList<AutoTotaalDienst> alleATDDB = new ArrayList<AutoTotaalDienst>(); try { this.leesDatabase(); output = statement.executeQuery("SELECT * FROM autototaaldienst"); while (output.next()){ double lp = output.getDouble("literprijs"); double wup = output.getDoub...
b243e19b-a297-49c9-96f0-041a57e84066
1
private boolean OpenFile() { //read status boolean status = false; try { //open the file output stream FileOutputStream outStream = new FileOutputStream(System.getProperty("user.dir")+"\\"+fileName); //set the data stream for the file ...
d87c9b7f-407d-48c5-9271-e53c1f133b7d
4
public void stopLoop(){ isRunning = false; // Stop the game-loop: try { game_loop_executor.shutdown(); game_loop_executor.awaitTermination(10, TimeUnit.SECONDS); } catch (SecurityException e){ e.printStackTrace(); } catch (InterruptedException ...
1b1df787-74d3-485c-a749-3976e6060a3d
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 62 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 62 ...
f0905813-198a-4e53-9af1-adb0ff167b94
3
private final void read(SelectionKey key) { @SuppressWarnings("resource") SocketChannel socketChannel = (SocketChannel) key.channel(); Session session = (Session) key.attachment(); mReadBuffer.clear(); int amount; try { amount = socketChannel.read(mReadBuffer); if (amount > 0) { session.requestHan...
6931bf87-78ec-4347-8c04-74288878cde7
3
private void printBezochteVelden(RouteMetaData[][] bezochtevelden) { System.out.println(""); System.out.println(""); for (int i = 0; i < bezochtevelden.length; i++) { for (int j = 0; j < bezochtevelden[i].length; j++) { if (bezochtevelden[i][j] != null) { ...
dd996a7a-bb21-4aaa-9f42-b838606c5be8
9
private boolean booleanOption(String s) { if (s == null) return true; switch (s) { case "true": case "yes": case "on": case "1": return true; case "false": case "no": case "off": case "0": return false; } throw new IllegalArgumentException("unrecognized boolea...
eae91171-1733-467e-84b9-65d490e04bdc
2
private void insertEmployeeIntoTable(Employee employee) { Object[] fields = new Object[7]; fields[0] = employee.getEmployeeNumber(); fields[1] = employee.getFirstName(); fields[2] = employee.getInsertion().isEmpty() ? "" : employee.getInsertion(); fields[3] = employee.getFamilyNa...
1b9f1859-bfef-433e-a1e7-ca78c46ba4e3
1
synchronized void delayAndPrint(int cnt) { try{ System.out.print("Thread:"+cnt+",Mehod:1-Am in"); Thread.sleep(2000); System.out.println(", After 2 sec out"); } catch(Exception e) { System.out.println("Error-"+e); } }
149e2efb-ad26-4144-926f-475e9a3946ab
8
private void recoleccion() { int estado; boolean cont=carro.evaluarActHuerto(); while(!carro.getCargado() && cont) { estado=carro.evaluarRecoleccion(); if(estado==Huerto.DISPONIBLE){ carro.recolectar(); try { sleep(harvestTime); } catch (InterruptedException e) { e.pr...
2bb3fb7c-d25d-482f-b558-357e1eba8c60
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Column other = (Column) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa...
8ce5fede-dc2c-488d-af0b-870e3f70a70e
9
public Void visitConditionDirective(ConditionDirectiveContext ctx) { if (ctx.LEFT_PAREN() != null) appendCode("("); switch (ctx.conditionDirective().size()) { case 0: if (ctx.definedCondition() != null) visitDefinedCondition(ctx.definedCondition()); ...
e801d031-46ab-43b9-8a04-1f2b05b96f0b
4
private void verifyUser(String username, String password) throws Exception{ schema = (FdotSchemaImpl) factory.getBean("connection_specs"); SdeConnection conn = new SdeConnection(schema.getServer(), schema.getInstance(), schema.getDatabase(), username, password); try{ ...
2f2cbb01-dfff-4463-9ea1-3966f43dbb03
2
private ChatSocketServer() { super(); for (int i = 0; i < rooms.length; i++) { if (i == DEFAULT_ROOM) rooms[i] = ChatRoom .getInstance(ManagerSocketServer.MAX_CLIENTS); else rooms[i] = ChatRoom .getInstance(GameSocketServer.MAX_NUMBER_OF_USERS_PER_GAME); } }
467f4e71-4a69-453c-bdf0-e2a558a89210
1
public Map<String, Constructor<? extends ICreature>> getConstructorMap() { return constructorMap; }
29826367-2983-40c4-8214-368b13ee7f0e
0
public int getEast(){ return this.east; }
b113850f-c42d-4ee5-9c58-fe3c10c191b3
9
protected void change() { Integer tickets = ticketsBox.getValue(); Integer friends = friendsBox.getValue(); Integer winners = winnersBox.getValue(); Integer limit = limitBox.getValue(); if (validate(tickets, 1000, 1, ticketsBox) && validate(winners, tickets, 1, winnersBox) && validate(limit, 100, 1,...
926f35b7-83fb-40d7-9169-9188ad2e9f55
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Role other = (Role) obj; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.de...
b5fe6deb-5b69-4ba5-994b-0b0845836955
3
@EventHandler public void onHit(EntityDamageByEntityEvent e ){ if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){ Player p = (Player) e.getEntity(); Player d = (Player) e.getDamager(); if(PlayerListener.getGhostMode(d)){ PlayerListener.toggleGhostMode(p); Main.getAPI().startSpe...
86b06dc1-239d-4545-8029-906ab852e2b0
9
@Override public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() == ItemEvent.SELECTED) { switch (opcao) { case 'm': jp = new ExibeAtracoes('m', linguagem, utilizador); //System.out.println("FrPrincipal...
d1001fc5-46ce-48d1-81b0-aaec51d1a97e
3
public ParseTreeNode rexp3() throws SyntaxError { ParseTreeNode node = new ParseTreeNode("<rexp3>"); if (symbol == '.' || symbol == '[' || isDefinedClass()) { node.addChild(charClass()); return node; } return node; }
75297967-d193-4b0f-96c4-6821c798168f
4
public Rectangle boundingBox(){ BufferedImage bi = animation.getImage(); Rectangle rect = new Rectangle(); switch(spikeDir){ case top: rect.x = (int) position.x(); rect.y = (int) position.y(); rect.width = bi.getWidth(); rect.height = 10; break; case bottom: rect.x = (int) position.x(); r...
d6b8c333-9289-49f8-9ac4-826193c6aed6
2
public static void makeRandomInteger(Matrix matrix) throws MatrixIndexOutOfBoundsException { int rows = matrix.getRowsCount(); int cols = matrix.getColsCount(); double temp = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { // fill with ra...
9d793280-edfe-4002-a8ec-fff41b223639
3
@Override public boolean removeAll(Collection<?> list) { boolean changed = false; for (Object o: list) if (remove(o)) changed = true; return changed; }
13937166-3166-4dc5-87af-8070adb716d3
2
public static void offerOrDropItem(EntityMinecart cart, ItemStack stack) { stack = transferHelper.pushStack(cart, stack); if (stack != null && stack.stackSize > 0) cart.entityDropItem(stack, 1); }
a5108298-98a7-4cb5-a34f-0b44dfa7171a
5
@EventHandler public void onPlayerInteract(PlayerInteractEvent event){ Action action = event.getAction(); if (action.equals(Action.RIGHT_CLICK_BLOCK)){ Player player = event.getPlayer(); Block block = event.getClickedBlock(); if ((block.getType().equals(Material.SIGN) || block.getType().equals(Material.SI...
fa204a8c-5aa3-4aa7-81ad-33e2bb466e0b
8
int readCorner4(int numRows, int numColumns) { int currentByte = 0; if (readModule(numRows - 3, 0, numRows, numColumns)) { currentByte |= 1; } currentByte <<= 1; if (readModule(numRows - 2, 0, numRows, numColumns)) { currentByte |= 1; } currentByte <<= 1; if (readModule(numRo...
e255b313-0a25-4d7d-a49a-bff364a6bccb
0
public boolean getIsFinished() { return finished; }
be088dfc-8368-406f-b4ce-26f78659cd46
5
public static void main(String[] args) { try { String input = null, output = "out.s"; for(int i = 0; i<args.length; i++) { switch(args[i]) { case "-o": // next item will be the filename of the disassembler // output ...
7889d434-cdb9-4f70-a60a-f7458ac0267b
0
public void ResetPlayer() { //booleans to control win and lose conditions raceWin = false; crashed = false; //place the car on the canvas x = (int) (Framework.frameWidth * 0.20); y = (int) (Framework.frameHeight * 0.70); //speed of the car speed...
87e881ea-2cb5-49d3-8101-0396e690e2a9
5
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line = ""; while ((line = in.readLine()) != null) { char[] m = line.trim().toCharArray(); int n = m.length; long row = 0,...
8672bf69-257d-4f09-abea-6145186d2f0d
2
public Set<T> less(Set<T> s) { Set<T> res=this; if(s==null) { return res;} else { if(res.next!=null) { return res.del(s.a).less(s.next);} else//res.next==null { return null; } } }
da8dcb09-ebf8-4769-9a43-0aeaed2c7865
3
private void evalArrayStore(Type expectedComponent, Frame frame) throws BadBytecode { Type value = simplePop(frame); Type index = frame.pop(); Type array = frame.pop(); if (array == Type.UNINIT) { verifyAssignable(Type.INTEGER, index); return; } ...
7f54e3fe-ffa8-4fbd-86d9-13938eced132
9
public static Ability getMyPlantsSpell(Item I, MOB mob) { if((I!=null) &&(I.rawSecretIdentity().equals(mob.Name())) &&(I.owner()!=null) &&(I.owner() instanceof Room)) { for(final Enumeration<Ability> a=I.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&((A.i...
3efb234c-6bb0-4956-9e41-7b8e3d6e63e0
8
private boolean uhattuVasemmalta(int pelaajaNumero, int x, int y) { int i = 1; while(y-i >= 0 && kentta[x][y-i].onTyhja()) i++; if(y-i == -1) return false; if(kentta[x][y-i].getNappula().omistajanPelinumero() != pelaajaNumero) { if(i == 1 && kentta[x][y-i].g...
80f438fb-ee2a-4703-b51f-b61386ad876a
7
void getCommands() { ArrayList<Commands> commands; DBase dbase = new DBase(); commands = dbase.getParserCommands(); for (Commands c : commands) { if (c.type.equalsIgnoreCase("Move")) { movement.add(c.word); } else if...
f48f571e-8922-4d01-9227-4a19ed0c064a
3
public KeyFrame getNextKey() { Iterator<KeyFrame> itr = keys.iterator(); while (itr.hasNext()) { KeyFrame k = itr.next(); if (k == currentKey) { if (itr.hasNext()) return itr.next(); } } return keys.get(0); }
fb25414b-76fd-434a-961a-75fa8b343c35
1
public void terminate() { stop = true; try { socket.close(); in.interrupt(); out.interrupt(); } catch (final IOException ioe) { // Ignore } logger.debug("Terminated peer exchange with " + peer + "..."); }
6bffdd12-87dd-4e53-9a52-558e73f57bd4
1
public void constructPieWithPieBuilder(PieBuilder pb) { this.pb = pb; constructed = false; if (this.pb != null) { this.pb.createNewPie(); this.pb.buildDough(); this.pb.buildFilling(); constructed = true; } else { BuilderClient.addOutput("error - no pie builder found!"); } }
16acc314-8e48-4e80-9729-09ce0d1ca575
7
protected void render() { if (allEntries.size() == 0) return ; // // First, determine a 'viewing window' for the text, if larger than the // visible pane- final Box2D textArea = new Box2D().set(0, 0, xdim(), ydim()) ; if (scrollbar != null) { final float lineHigh = 0 ;// alphabet.map[' '...
bdd4f5bb-d7c4-405a-8ef1-b0f00853c955
8
public Color convertToColor(SquareColor color) { if (color == null) { return Color.WHITE; } switch (color) { case BLUE: return Color.BLUE; case RED: return Color.RED; case YELLOW: return Color.YELLOW;...
670ceac3-c580-4e5c-be88-e2d19ee542e9
9
private void receiveAndDispatch() throws Exception { try { Session session = receiveTemplate.getSession(); MessageConsumer consumer = receiveTemplate.getMessageConsumer(); Message msg = consumer.receive(500); if (msg != null) { if (MSG_TYPE_REQUEST...
f63dfe36-4ab5-447d-8f4b-3434bd36648a
3
private static void clearBuffer() { if (N == 0) return; if (N > 0) buffer <<= (8 - N); try { out.write(buffer); } catch (IOException e) { e.printStackTrace(); } N = 0; buffer = 0; }
2ee668cb-e7a4-4075-b02e-f4c1da9e768a
7
public boolean canMove(int i, int j, Direction d) throws CellDoesNotExistException { checkCellExists(i, j); if (isWallUp(i, j, d)) { // There is a wall that is blocking us, so we cannot move that way. return false; } else { // No wall, so let's see if we can move that way. int i1 = i; int j1 = j; ...
9a2a6a96-ad71-4321-91ed-2805bcca83c5
2
public static <T extends DC> Set<Pair<PT<Integer>,T>> dom(Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().fst(),dom(phiMax.getNext())); } else { return new Set(phiMax.getFst().fst(),null); } ...
a2ef2f38-eea6-426d-acd3-b2e615a19dea
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tuple3 tuple3 = (Tuple3) o; if (_0 != null ? !_0.equals(tuple3._0) : tuple3._0 != null) return false; if (_1 != null ? !_1.equals(tuple3._1) : ...
955ce9dc-b434-48bd-8dbf-23cce338b7df
6
@Override public void enumerate(String uid, String connectedUid, char position, short[] hardwareVersion, short[] firmwareVersion, int deviceIdentifier, short enumerationType) { // configure bricks on first connect (ENUMERATION_TYPE_CONNECTED) // or configure bricks if enumerate was raised externally (ENUME...
15bc4322-f863-4091-93ab-b6fe11c4da38
2
public CheckReport1(File file) throws Exception { this.file = file; fileName = file.getName(); fileNameSections = fileName.split("\\.")[0].split("_"); if (fileNameSections.length == 4) { // 记录期数 monthDate = fileNameSections[3]; } else if (fileNameSections.length == 3) { // 记录期数 monthDate = fileNam...
f83fa474-8b88-4755-9ed8-99083e5f62f1
8
@Override public SQLExceptionConverter buildSQLExceptionConverter() { return new SQLExceptionConverter() { private static final long serialVersionUID = 1L; public JDBCException convert(SQLException sqlException, String message, String sql) { final int errorCode = JdbcExceptionHelper.extractErrorCode(...
76665e38-0545-450d-a763-c41f4453fa8a
6
public void WGStatus(String channel, String sender) { Integer setwords = 0; String availablewords = new String(); HashMap<String, Integer> setusers = new HashMap<String, Integer>(); Game game; game = games.get(getServer() + " " + channel); if(game == nul...
05b3db58-4d25-4859-a9db-52b2db8993c8
0
public Boolean isFinished() { return isFinished; }
2117ef7a-1551-47bd-9efe-07e8f1bb2f79
0
public Deck() { init(); }
8e95bdb3-d104-40bd-b2db-c01c8a9cdb81
4
public void startGame(List<Player> players, MenuPanel menu){ this.allGameFrames = new HashMap<Player,GameFrame>(); getContentPane().remove(menu); setVisible(false); dispose(); if(players == null || players.size() <2){ throw new IllegalArgumentException("Invalid players number. Can't start the game.");...
39254ad6-8c2e-47b6-84da-f83bb46c97bf
7
private double checkTransform() { if(getLoc().nextTile != null) { if(getLoc().getCoordinates().x - getLoc().nextTile.getCoordinates().x > 0) return (-Math.PI/2); else if(getLoc().getCoordinates().y - getLoc().nextTile.getCoordinates().y < 0) return (Math.PI); else if(getLoc().getCoordinates().x - getLoc(...
13d2a206-6737-4f12-bae0-ca24448bab59
5
boolean resolve(final MethodWriter owner, final int position, final byte[] data) { boolean needUpdate = false; this.status |= RESOLVED; this.position = position; int i = 0; while (i < referenceCount) { int source = srcAndRefPositions[i++]; int reference = srcAndRefPositions[i++]; int offset; if...
0e0218e0-c188-491f-99b7-950bc82d32a7
7
DeclarationsNode declaration() { // Declarations = [�CONST� ident �=� Expression �;� {ident �=� // Expression �;�}] // [�TYPE� ident �=� Type �;� {ident �=� Type �;�}] // [�VAR� IdentList �:� Type �;� {IdentList �:� Type �;�}] // {ProcedureDeclaration �;�} ArrayList<ConstDeclarationNode> consts = new Arr...
08e6f3c7-defb-466c-a6e4-aa43eaf8e028
9
@Override public boolean tick(Tickable ticking, int tickID) { if((tickID==Tickable.TICKID_MOB) &&(statue!=null) &&(affected instanceof MOB)) { final MOB mob=(MOB)affected; mob.makePeace(true); if((statue.owner()!=null)&&(statue.owner()!=mob.location())) { Room room=null; if(statue.owner() ...
6ce660a7-9d33-4570-b193-256cefdfa0e7
5
public boolean loadPanel(){ try{ /*fc.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = fc.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile();*/ BufferedReader br = new BufferedReader(new FileReader(new File("panels.xml")));...
33687d7d-fa5d-4906-976e-6bcddea47c1e
0
public long getSeatType() { return this._seatType; }
e711eaba-59a0-4197-b8dc-1a23db0d19b5
1
public static void main(String[] args) throws IOException { File f = new File("src/IntegerArray.txt"); Scanner s = new Scanner(f); int i = 0; while(s.hasNext()){ array[i] = s.nextInt(); i++; } // BruteForceMethod(); int n = array.length; Mergeforcemethod(0 , n); }
6f8a4e8f-0e48-4a6a-9ebd-8faf42e4514f
4
public static int countAdjecentTracks(World world, int x, int y, int z) { int i = 0; if (isTrackFuzzyAt(world, x, y, z - 1)) ++i; if (isTrackFuzzyAt(world, x, y, z + 1)) ++i; if (isTrackFuzzyAt(world, x - 1, y, z)) ++i; if (isTrackFuzzyAt(w...
f391766d-7c33-4913-aafc-81197179d74f
7
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { String name = "" + dir; if (!name.toLowerCase().contains("sopa")) { return CONTINUE; } if (name.equalsIgnoreCase(ROOTDIR)) return CONTINUE; String[] comps = ...
744ee4df-3fa2-433f-a772-1f6ff03e2af2
5
public static int indexOf(Object[] arr, Object obj) { if (obj == null) { for (int c = 0; c < arr.length; c++) { if (arr[c] == null) { return c; } } } else { for (int c = 0; c < arr.length; c++) { if (obj.equals(arr[c])) { return c; } } }...
80759e33-d327-4a89-8f06-46bf3a77bbff
1
public void init(int nplayers, int[] pref) { this.nplayers = nplayers; this.index = getIndex(); this.pref = pref; length = pref.length; transform = new int[length]; distribution = new int[length]; observedlist = new int[length]; distsum = new int[length]; choicelist = new int[nplayers + 1][length]; ...
c1cad612-b5de-4091-8b3e-8301e00ee677
2
private String formatKey(String key){ if(!caseSensitiveLookup){ key = key.toLowerCase(); } if(asciiFoldingLookup){ key = StringUtils.stripAccents(key); } return key; }
0a45dc5f-c429-4915-a606-949bcc4599d0
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
94d1a16b-83a4-4665-8ec2-33886aacd0da
2
public static long getLong(ByteBuffer in) { int a = in.get() & 0xFF; int sign = (a & BYTE_SIGN_NEG); long value = (a & 0x3fL); int shift = -1; while ((a & BYTE_MORE) != 0) { a = in.get() & 0xFF; value |= (a & 0x7FL) << (shift += 7); ...
ec545d1c-5b4c-433f-98b6-76f08b4865be
8
private static void makeTet6(SquareColor[][] tet) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (((i == 1 || i == 2) && j == 0) || ((i == 2 || i == 3) && j == 1)) { tet[i][j] = SquareColor.RED; } else tet[i][j] = null; ...
561ee844-9001-4026-b152-94e425bf8985
7
public void setDim(int dim) throws ConnectException { int maxDim = dim; for (InputConnector ic : inputs) { if (ic.isConnected()) { if (dim != 0 && ic.getSource().getDim() != dim) throw new ConnectException(ic.getSource(), dim); if (maxDim < ic.getDim()) maxDim = ic.getDim(); } } if (outp...
07bcb82c-584a-4136-b061-64b7c5ed12fb
8
static <T> Class<T> boxClass(Class<T> type) { if (type == boolean.class) { return (Class<T>) Boolean.class; } else if (type == byte.class) { return (Class<T>) Byte.class; } else if (type == char.class) { return (Class<T>) Character.class; } else if (ty...
217c4d5a-7d5c-411b-91b3-57456323f33a
2
public boolean atBP() { double predictedTemp = getBPTemp(); if(temp <= predictedTemp+2 && temp >= predictedTemp-2) return true; return false; }
cbdbac1e-0e0a-4271-bfac-699c531dc55c
5
@Test public void testPausedState() throws ProcessExecutionException, ProcessRollbackException { IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true); // use reflection to set internal process state TestUtil.setState(comp, ProcessState.PAUSED); assertTrue(comp.getState() == ProcessState.PAUSE...
e52c0718-753b-4ab3-a049-d05f34c179bd
3
public void printMessageContainer() { System.out.println("MessageContainer for round " + round); for (int i = 0; i < msgs.length; i++) { if (msgs[i] == null) { } else if (i != (pid - 1)) { System.out.println("Pid: " + msgs[i].pid + " Round: " + msgs[i].round); msgs[i].printMessage(); } } }
25813e03-d9e5-4fcf-853c-cc86f42b3ee8
9
private static Vector<Integer> checkNeighbourhood(BufferedImage img, int x, int y, int r) { Vector<Integer> vect = new Vector<>(); for (int i = x - r; i <= x + r; i++) { for (int j = y - r; j <= y + r; j++) { if (i >= 0 && j >= 0 && i < img.getWidth() && j < img.getHeight()) { if (img.getRGB(i...
6837d5f2-0e0c-421a-9013-80bc42f5ae6e
4
public static HtmlRedirect parse(String content, VariableMap variables) { HtmlRedirect ret = new HtmlRedirect(); int semi = content.indexOf(";"); if (semi == -1) { // Just a number, no URL, e.g., MRTG does this ret.seconds = Integer.parseInt(content); return ret; } Matcher match = META_REFRESH_CONTENT_...
f67fda62-d831-4b84-bb1f-69500a81269f
9
public int lengthOfLongestSubstring(String s) { int longest, mindex, n = s.length(), startindex = 0, endindex = 1, lastindex; int[] map = new int[26]; char[] c = s.toCharArray(); if (n == 0) { return 0; } else { longest = 1; } for (int m = 0; m < 26; m++) { map[m] = -1; } while (startindex ...
b3123473-bb61-4e12-9638-607635b2badb
5
public RoomCell(int i, int numRows, int numCols, String config) { super(i, numRows, numCols); // Door handling. doorDirection = DoorDirection.NONE; roomInitial = config.charAt(0); String roomSpec = config; if(roomSpec.length() > 1) { // Then we have a door. char door = roomSpec.charAt(1); if(door =...
469f57d9-a4bc-4b97-bfa4-d01d22df37ce
9
public void calculateInitialScore(ROB_entry entry) {//calculate the score based on which heuristic we use for the score function if(heuristic.type == HeuristicType.heuristic_LATENCY_SNR ) {//sum of sequence number and multiplier * latency entry.score += latencyMultiplier * entry.theUop.exec_latency;...
3a37563f-3e17-48b2-a435-90aee60891ab
4
public void llenarTabla(JTable tabla)throws Exception{ ResultSetMetaData rsm; DefaultTableModel dtm; Menu menu = new Menu(); Statement consulta = menu.conexion(); ResultSet resultado = consulta.executeQuery("SELECT * FROM tblproductos "); rsm=resultado.getMetaData(); ...
8c569c31-18c1-4fb5-a36d-161ba13a36bc
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...
2c12ffe1-b4f7-4040-9085-3eb8da146529
1
protected void requireConfigKey(final String key) { if (config.getProperty(key) == null) { throw new Error("missing required configuration key: '" + key + "'"); } }
b44a5bc2-cfac-47fb-b35a-3d20cd9fdb34
1
public static <T extends Model> List<T> createSQLQuery(final Class<T> cls, final String sql, final String... params) { final List<T> result = new ArrayList<T>(); synchronized (Lock) { final DBOpenHelper helper = Beans.getBean(DBOpenHelper.class); SQLiteDatabase database = helper.getReadableDatabase(); f...
52642e12-74cf-4fa8-8668-4fbde42cec3d
3
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...
1c388592-ec8a-492c-a853-ea5154bb131d
8
protected boolean disconnectInput(NeuralConnection i, int n) { int loc = -1; boolean removed = false; do { loc = -1; for (int noa = 0; noa < m_numInputs; noa++) { if (i == m_inputList[noa] && (n == -1 || n == m_inputNums[noa])) { loc = noa; break; } } if (loc >= 0...
82eaa98f-88b8-461c-bc50-1c0879c6c73d
7
public void checkBattle() { if (noBattle == false) { if (stepscount >= rndwildmodify) { lastBGM = currentBGM; currentBGM.stop(); currentBGM = wildbattle; currentBGM.start(); enemylvl = (byte) (first.getLevel() * (9 / 10)...
f1453ab0-4fba-4b26-bb05-7b06015c884c
8
public void printSquares(List<Point2D> list, Point2D p1, Point2D p2, Game game) { Square origin = squareAt(p1); Square goal = squareAt(p2); System.out.println(" == MAP SIZE: " + (xArraySize*TILE_SIZE) + "x" + (yArraySize*TILE_SIZE) + " == "); for (int y = 0; y < yArraySize ; y++) { for ...