method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
71ba5aac-7f8c-4e72-b13d-f34abc918e0c
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof DateType)) { return false; } DateType other = (DateType) object; if ((this.key == null && other.key != null) ||...
6eb17d34-4479-404c-8c53-98d5078a1094
7
public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); int decimal = input.nextInt(); String hexString = ""; int value = decimal; while (value != 0) { //对于 decimal 为0的情况,程序不能得出正确结果。 ...
9298ab10-6a76-4e2d-b77c-23947d66fdf7
1
@OnClose public void onClose(Session userSession) throws IOException { chatroomUsers.remove(userSession); Iterator<Session> iterator = chatroomUsers.iterator(); while (iterator.hasNext()) { (iterator.next()).getBasicRemote().sendText(buildJsonUsername()); } }
e4cccf13-0904-4e23-baf2-db1985f90f34
9
private boolean containsHelper (String s, int indexLow, int indexMid, int indexHigh) { if ((s.compareTo(LexiconArrayList.get(indexLow)) < 0) || (s.compareTo(LexiconArrayList.get(indexHigh)) > 0)) { //If the word cannot be found after running contains, return false return false; } else if ((s.compareTo(LexiconA...
8a45647b-ec79-4add-8319-526179bfcc12
4
public static void main( String[] argv ) { try { String[] stopMarks = new String[] { "%MARK_0%", "%MARK_A%", "%MARK_B%", "%MARK_C%", "%MARK_D%" }; String[] replacements = new String[] { "Hello", "This", "very", "stream replacement", "Goodbye." }; String data = stopMark...
ba2b5fc9-7356-4739-b04d-779579255204
9
void expand(ArrayList<Integer> C,ArrayList<Integer> P){ if (timeLimit > 0 && System.currentTimeMillis() - cpuTime >= timeLimit) return; nodes++; int m = P.size(); int[] colour = new int[m]; numberSort(C,P,P,colour); for (int i=m-1;i>=0;i--){ if (C.size() + colour[i] <= maxSize) return; int v = P.get(i);...
7bf2306f-0359-4d46-a4eb-f2560b154940
1
public static String reverse(String toReverse) { if(toReverse.length() == 1){ return toReverse; } return reverse(toReverse.substring(1)) + toReverse.charAt(0); }
e06ccff3-714e-4daa-8907-de8d9f47a56f
1
public MysqlDatabase() throws Exception { // load the driver for mysql try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch(Exception e) { // no need to distinct exception type // if that doesn't work the driver cannot be found ...
1e87a09a-1e68-4415-a1eb-91fd40af9a88
1
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public void unassertWithBookkeepingAndWithoutTranscript(CycList sentence, CycObjec...
45bdaf5e-8735-47dd-bebf-489bbfaa01fd
6
public boolean reloadFromFile() { if (_fileName == null) { return false; } boolean success = true; int tilesWide = 0; int tilesHigh = 0; byte mask[][] = null; try { File f = new File(_fileName); FileInputStream fis = new FileInputStream(f); DataInputStream dis = new DataInputStream(fis); ...
0287886d-d35d-439c-93d1-d7168c692673
5
public BoardNode[] findWord(String word){ //Method finds any occurrence of a word on the board, returning an array of the path for first found //Complexity analysis -- finding start points is O(n), the search is more difficult to analyze, absolute worst case is //where word is all one character, n/2 chars long ...
ef6a1434-0c39-47a6-a1d9-79c403324428
7
void checkBetaSheetAlphaHelixOverlap(byte[] codes, float[] angles) { for (int i = monomerCount - 2; --i >= 2;) if (codes[i] == CODE_BETA_SHEET && angles[i] <= 140 && codes[i - 2] == CODE_RIGHT_HELIX && codes[i - 1] == CODE_RIGHT_HELIX && codes[i + 1] == CODE_RIGHT_HELIX && codes[i + 2] == CODE_RIGHT_HELI...
b67481aa-64d3-4331-a79a-5704cc717d09
3
@Test public void topicsTest() { Content banana = new Content(); banana.setContent("banana"); Content apple = new Content(); apple.setContent("apple"); Content orange = new Content(); orange.setContent("orange"); speaker.addContent("...
a5ce10b7-6a23-40e8-821a-6cbe9ad9d37c
3
public Builder mergeReplyMessage(protocols.ChatProtocol.ReplyMessage value) { if (replyMessageBuilder_ == null) { if (((bitField0_ & 0x00000020) == 0x00000020) && replyMessage_ != protocols.ChatProtocol.ReplyMessage.getDefaultInstance()) { replyMessage_ = protoc...
06802fc9-9220-4442-a276-60cedbdb5ffa
5
private static void readPixmap(Grid grid, String path, TileShape shape, int size, int rotation) { Pixmap p = new Pixmap(Gdx.files.internal(path)); for(int i = 0; i < p.getWidth(); i++){ for(int j = 0; j < p.getHeight(); j++){ int c = p.getPixel(i, j); if(c == red){ // Gdx.app.log("LevelLoader", "red ...
aff04038-c0ea-46e9-b4b4-17d0114a52d2
4
@Override public final void run() { byte[] buf = new byte[SIZE]; final DatagramPacket datagramPaquet = new DatagramPacket(buf, buf.length); while (true) { try { socket.receive(datagramPaquet); buf = datagramPaquet.getData(); ...
4aa1c16f-2fef-486d-801c-7cf7b6a6ea96
3
public FieldCircularList getDiceNext(int index) { //TODO check if the last condition is needed //checks if the dices aren't 0, if the next field's number is smaller than the current field's and if the next //field's number is not 0 index -= 2; if(index >= 0 && FIELDNUMBER < diceArray[index].getFieldNumber() &...
f6c04e19-a574-4c26-a2cd-45bd5a1bf296
6
public static double[][] readMatrix2(Path path, HamaConfiguration conf, int rows, int columns, int blockSize) { int finalRows = getBlockMultiple(rows, blockSize); int finalCols = getBlockMultiple(columns, blockSize); double[][] matrix = new double[finalRows][finalCols]; int i=0; String[] row; try { ...
de2812d8-b9c9-484a-9421-67ed6303bb97
9
public int minCut2(String s) { int length = s == null ? 0 : s.length(); if (length == 0) return 0; int[] dp = new int[length + 1]; for (int i = 0; i < length; ++i) { dp[i] = length - i; } boolean[][] palindromes = new boolean[length][length]; ...
85bc1515-6313-4c1d-8048-d9bf4abca37c
9
public void setValue(ELContext context, Object base, Object property, Object val) { if (context == null) { throw new NullPointerException(); } if (base != null && base instanceof List) { context....
ea93dd1f-5735-4cfa-a25f-f032023ee9eb
2
public static final boolean startsWithVowel(String text) { if (text != null && !text.isEmpty()) { return isVowel(text.charAt(0)); } return false; }
a3216c2d-aece-499b-9aff-fa5fd8d5badc
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbAttachmentByUDescrIdxKey ) { GenKbAttachmentByUDescrIdxKey rhs = (GenKbAttachmentByUDescrIdxKey)obj; if( getRequiredContactId() < rhs.getRequiredContactId() ) { return( -1 ); } else if( getRequi...
b0816a4a-4ed2-4d00-b865-d17e01b48ad7
8
public static String bestBefore(String input) { int[] numbers = splitDate(input); BasicDate earliest = null; for (int i=0, d, m, y; i<3; i++) { d = numbers[i]; // day m = numbers[(i+1)%3]; // month (or year, if it cannot be a month) y = numbers[(i+2)...
99b15026-0ecf-4896-9f2c-3b5ccba8a8b1
3
public int[] getY() { int[] array = new int[size]; if(start_y > stop_y) { int indey = 0; for(int y = start_y; y >= stop_y; y--) { array[indey++] = y; } } else { int indey = 0; for(int y = start_y; y <= stop_y; y++) { array[indey++] = y; } } return arra...
0714457d-4285-4ba6-8906-9db6551160f7
1
private static String getFileContents(String filename) throws IOException, FileNotFoundException { File file = new File(filename); StringBuilder contents = new StringBuilder(); BufferedReader input = new BufferedReader(new FileReader(file)); try { String line = ...
7afbdd24-ffbb-4106-bca7-845ba9af19db
8
public boolean goalRight() throws Exception { int[] temp = new int[goal.length + 1]; int spaces=0; for (int i = 0; i < temp.length; ++i) temp[i] = 0; for (int i = 0; i < goal.length; ++i) { int x = 0; if (!goal[i].toString().equals(" ")) { x = new Integer(goal[i].toString()); if (x >= go...
366a677e-abc5-45c2-b107-6487ed24ef0e
1
public void stopDMESG() { getDMESG = true; for (int i = 0; i < 500; i++) {} }
0fd93975-bbd7-48f0-bbf0-5b1daaccdb61
1
public void win(Player p) { this.setChanged(); this.notifyObservers(); for(;;){} }
1944bd89-70f1-44bb-a875-a3846ac6ac96
6
@EventHandler public void CreeperHarm(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCreeperConfig().getDouble("Creeper.Harm.Do...
33e334cf-49dc-4443-a0be-3202d8403e96
8
public String getToolTipForCell(Object cell) { String tip = "<html>"; mxGeometry geo = getModel().getGeometry(cell); mxCellState state = getView().getState(cell); if (getModel().isEdge(cell)) { tip += "points={"; if (geo != null) { List<mxPoint> points = geo.getPoints(); if (po...
8e90f427-c075-4bb1-8c12-f2c96fc0f2ee
1
public static int getPositiveNumber(Scanner scanner, String message) { int number = 0; number = getNumber(scanner, message); while (number <= 0) { System.out.println("Error: incorrect number."); number = getNumber(scanner, message); } return number; }
54ec73b7-e803-40d8-8e14-a48dc3b1e737
9
public void fillJList() { model = new DefaultListModel<String>(); String tip_box = box.getSelectedItem().toString(); switch (tip_box) { case "Profesor": tip = TipUtilizator.Profesor; for (Profesor p : Centralizator.getInstance().getProfesor()) { model.addElement(p.getNume() + " " + p.getPrenume()); ...
64a2fa2c-c802-4eea-ad5f-9052d145aae3
1
public static int[] newIntArray(int size, int defaultValue) { int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = defaultValue; } return array; }
7f02e07a-b2e0-4eef-af73-c7bcdc905b70
0
public EnvironmentHelpAction(Environment environment) { this.environment = environment; }
5fd27075-bcb1-4e9f-808d-1237e1b4ffb2
4
static void checkGameOver() { for (Ship[] row : gridArray) { for (Ship ship : row) { if (ship == null) continue; if (ship.isSunk()) return; } } JOptionPane.showMessageDialog(null, "Game over!"); }
4f30a0d5-8e3f-4cbe-9798-9075696951f4
8
public void appendTag(Tag tag) { // item final Element item = createTagLIElement(new EventListener() { @Override public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONKEYDOWN && (event.getKeyCode() == KeyCodes.KEY_BACKSPACE || event.getKeyC...
9f31a7f1-67fa-469d-87d5-77c011c01c32
1
public void changeState(State<BaseGameEntity> pNewState) { if(pNewState == null) System.out.println("<StateMachine.changeState>: trying to change to NULL state"); //keep a record of the previous state pPreviousState = pCurrentState; //call the exit method of the existing state pCurrentSt...
22935644-48ee-4d56-a5a8-2ccbc877bd2e
6
public void queueBytes(int i, byte abyte0[]) throws IOException { if(closed) return; if(hasIOError) { hasIOError = false; throw new IOException("Error in writer thread"); } if(buffer == null) buffer = new byte[5000]; synchronized(this) { for(int l = 0; l < i; l++) { buffer[buffInd...
189c56b6-f185-443b-82ef-821beae8efec
1
public static synchronized RoboBase getInstance() { if (instance == null) instance = new RoboBase(); return instance; }
1ba592da-f5f2-48e9-a7b6-d519ce1459d3
2
public static boolean convertObjectToBoolean(Object value) throws IllegalArgumentException { if (value != null) { if (value instanceof Boolean) { return ((Boolean) value).booleanValue(); } else { return Boolean.valueOf(value.toString()).booleanValue(); } } else { throw new IllegalArgumentExcepti...
4c6cec36-0391-4dd2-8774-03c8a1887abe
2
@Produces public FXMLLoader createLoader() { FXMLLoader loader = new FXMLLoader(); loader.setControllerFactory(new Callback<Class<?>, Object>() { @Override public Object call(Class<?> param) { return instance.select(param).get(); } }); return loader; }
2121784b-9a09-46c3-b23b-43683dbb285d
1
private void calculateStatistics() { for (int i = 0; i < FIELD_COUNT; i++) { statistics.add(generateStatistics(i)); } dividendStats = (doStatsOnDividendSum()); }
f17561f4-cd12-4459-b66f-75d7bfda4b0d
1
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { this.version = version; this.access = access; this.name = name; this.signature = signature; this.superName = superName; if (interfaces != null) { th...
24f9c2a7-3195-486a-9f94-d3bf16858918
2
@SideOnly(Side.CLIENT) @SubscribeEvent public void onClientTick(ClientTickEvent event) { final Minecraft minecraft = FMLClientHandler.instance().getClient(); final WorldClient world = minecraft.theWorld; if (world != null && TickHandlerClient.checkedVersion) { MCUtil.checkVersion(Side.CLIENT); TickHan...
6c9c6f0e-c68c-42ea-adab-7411a9ec17ce
9
public static synchronized void loadLibrary(String name) { if(loadedLibraries.contains(name)) return; // find implementation for given library name LibraryImplementation libImpl = null; if(libSet != null) libImpl = libSet.findImplementation(name); // if there is none, try to load library the 'normal'...
1b0a1f07-6cd2-47bc-ab8b-18fb16ed0733
8
public static boolean computeCell(long world, int col, int row) { // liveCell is true if the cell at position (col,row) in world is live boolean liveCell = getCell(world, col, row); // neighbours is the number of live neighbours to cell (col,row) int neighbours = countNeighbours(world, col, row);...
973cc99b-1092-47e3-92ba-d049162ccc00
7
public static void main(String[] args) { int newport = 0; String log = ""; if (args.length > 0) { args[0].trim(); try { newport = Integer.parseInt(args[0]); } catch (NumberFormatException e) { if (!args[0].equalsIgnoreCase("-h")) { System.out.println("server: In...
5fc8576e-0bed-4725-81d9-7c95eee9e38a
5
private static Configuration parseConfigFromPost(WikiContext context, Query query, int listenPort, String oldSSK) { boolean allowImages = false; if (query.containsKey("images")) { allo...
469ff8cb-5da1-4825-9524-cdfcebc61721
6
final short[] method1268(int i, short[] is) { anInt2171++; int i_0_ = 14 % ((i - 48) / 33); if (anIntArrayArray2163 != null) { int i_1_ = 14 + (int) ((long) anInt2159 * (long) is.length / (long) anInt2164); int[] is_2_ = new int[i_1_]; int i_3_ = 0; int i_4_ = 0; for (int i_5_ = 0; (i...
07d9c284-ae54-4b6b-b30c-e6f09a75ebe3
6
@EventHandler public void PigZombieBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("PigZom...
f4840798-9585-4d59-886f-72f6c24d4070
9
public GameStatusEnum getStatus() { if (this.launchAllowed) { return GameStatusEnum.START; } else if (this.hit) { this.hit = false; return GameStatusEnum.HIT; } else if (this.wallHit) { this.wallHit = false; return GameStatusEnum.WALLHI...
e3c3ed06-d186-4fac-b3e8-5f5353e8c85d
9
public boolean equals( Object obj ) { if( obj == null ) { return( false ); } else if( obj instanceof GenKbURLProtocolBuff ) { GenKbURLProtocolBuff rhs = (GenKbURLProtocolBuff)obj; if( getRequiredURLProtocolId() != rhs.getRequiredURLProtocolId() ) { return( false ); } if( ! getRequiredName().equ...
9f883b4f-0366-4811-a8cf-aded7ee7fa6e
1
private void openServerSocket() { try { this.serverSocket = new ServerSocket(Setup.ROUTING_PORT, 0, Setup.address); isRunning = true; } catch (IOException e) { isRunning = false; this.serverSocket = null; isStopped = true; Setup.pri...
df859665-fbd5-42c7-9e26-d0251bea274b
3
private final void des_encrypt(int[] data, int[] ks, boolean encrypt) { int l,r,t,u; int i; u=data[0]; r=data[1]; { int tt; tt=((r>>>4)^u)&0x0f0f0f0f; u^=tt; r^=(tt<<4); tt=(((u>>>16)^r)&0x0000ffff); r^=tt; u^=(tt<<16); tt=(((r>>>2)^u)&0x33333333); u^=tt; r^=(tt<<2); tt=((...
1e0b7478-3f8e-46c9-9f3f-4efe00a410f5
5
final void method3881(Object object, byte i, Canvas canvas) { try { anInt9880++; if (i == 99) { Long var_long = (Long) object; if (!anOpenGL9856.setSurface(var_long.longValue())) throw new RuntimeException(); } } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929...
fcf030c3-652c-4375-b4e0-84c34c4400d3
2
public String toDecodedString() { StringBuilder sb = new StringBuilder(); try { sb.append("announce: " + announceUrl).append("\n"); sb.append("creation date: " + decoded.get("creation date").getNumber()) .append("\n"); sb.append("created by: " + decoded.get("created by").getString()) .append...
8a057bca-a26a-4974-9af8-6bc7e04e5d08
9
public void run() { board.setLocation(0, 0); board.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); board.add(this); board.pack(); board.setVisible(true); initializeUnits(this); board.addMouseListener(new MouseListener() { public void mouseReleased(Mous...
2dfc95af-49ff-46cc-9021-1901ac6b888b
3
public SaveURL(String fileName, String urlString) throws MalformedURLException, IOException, FileNotFoundException{ BufferedInputStream in = null; FileOutputStream fout = null; // BufferedWriter fout = null; try { in = new BufferedInputStream(new URL(urlString).openStream()); String mcdir; fout = ne...
7441b592-7542-4c41-9ca9-9600ee368d24
3
public void ZipIt() { byte[] buffer = new byte[1024]; try { FileOutputStream fos = new FileOutputStream(_outputZipFile); ZipOutputStream zos = new ZipOutputStream(fos); System.out.println("Output to Zip : " + _outputZipFile); for (String file : this._fileList) { System.out.println("File Added ...
b8f4042a-7779-4d76-a59b-948203698629
4
protected static <K> Map<K, Color> calculateScaling(Map<K, ? extends Number> scaling, Color colorMin, Color colorMax) { float min = Float.MAX_VALUE; float max = Float.MIN_VALUE; for(Number num : scaling.values()) { min = Math.min(min, num.floatValue()); max = Math.max(max, num.floatValue()); } float[] ...
f21fdbc3-1e25-4e0c-82a7-ec70ebddf346
9
private int pixelFitness(Wallpaper wp, int x, int y) { int fitness = 0; int pixelC = wp.pixels[y][x]; for(int i = 1; i <= maxLookaround; i++) { int minYLook = Math.max(y-i, 0); int maxYLook = Math.min(y+i, maxY); int minXLook = Math.max(x-i, 0); ...
1ea76f80-f560-4b30-88ef-2bea16ff7b37
4
private void manupilateDataInstruction(String instruction, int line) throws SyntaxErrorException{ try { String[] splitted = instruction.split(" "); String label = splitted[0].split(":")[0]; String dataType = splitted[1]; if (!dataType.equals(".word")) { throw new SyntaxErrorException(line); } if...
f0c4c6c5-1309-45ee-85eb-e6aa0c486b99
4
@Override public boolean singleStep() { if (!queue.isEmpty()) { Vertex u = queue.dequeue(); DoublyLinkedList<Vertex> neighbours = adjacency.getNeighbours(u); Vertex v = neighbours.succ(neighbours.min()); while (v != null) { if (v.getColor() == ...
321a6624-7ed6-4c13-b5c1-fec8c617e1dd
5
public boolean moveAI(Enemy m){ char e_dir=m.getDirection(); int fx=m.getX(),fy=m.getY(); if(e_dir=='u')fy-=m.getSpeed(); else if(e_dir=='d')fy+=m.getSpeed(); else if(e_dir=='l')fx-=m.getSpeed(); else if(e_dir=='r')fx+=m.getSpeed(); if(level_collision(fx,fy,m.getWidth(), m.getHeight())){ m.collide(); /* i...
af7b98c6-0679-4a22-810f-059e638a326b
5
public void run() { long lastTime = System.nanoTime(); double nsPerTick = 1000000000.0 / 60.0; int frames = 0; int ticks = 0; long lastTimer = System.currentTimeMillis(); double delta = 0; init(); while (running) { long now = System.nanoTime(); delta += (now - lastTime) / nsPerTick; ...
de0e8f56-6f3c-4b83-a1f8-273eb740f4e1
3
private boolean checkTextFields() { String emptyText = new String(""); if(employeeName.getText().equals(emptyText)) { JOptionPane.showMessageDialog(null, "Please submit a valid Employee"); return false; } if(employerName.getText().equals(emptyText)) { JOptionPane.showMessageDialog(null, "Please sub...
9507c346-0f75-4b28-888f-f2d540cb3098
3
public boolean equals(Object o) { if (o == this) return true; else if (o == null) return false; else { Coordinates temp = (Coordinates) o; return ((this.latitude == temp.getLatitude()) && (this.longitude == temp.getLongitude())); } }
3ed4a284-ddf5-4a1c-9c44-7c2372959fd0
1
private void loadContent() { try { img_cannon = ImageIO.read(this.getClass().getClassLoader().getResource("img/Cannon.png")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
761565d4-808a-4481-b1a5-f045b8f7b20a
8
public void read() { try { br = new BufferedReader(new FileReader(csvFile)); line = br.readLine(); while ((line = br.readLine()) != null) { String[] cal = line.split(splitBy); int i = 0; String titre = cal[i++]; ...
497f2756-a208-4ee7-9f97-432d7d6f72c2
0
public String getContactPos() { return contactPos; }
7a577cbb-ff95-4f8b-a1fb-051064b4cb9c
9
public ArrayList<Integer> useableRoadLocations(Player P) { ArrayList<Integer> returnArray=new ArrayList<Integer>(); for(GamePiece p:verts) { if((!(p==null))&&(p.type==1||p.type==2)&&playerList.get(p.player).equals(P)) { //if(gl.resDistr.get(gl.SClocs.get(p.location).resIndex1).type==0)Lr+=getProb(gl.he...
24a4e635-5908-44dd-a58d-4c6936cb1853
4
private void loadParticipants() { DefaultListModel<Anstalld> dlm = (DefaultListModel<Anstalld>) listParticipantsHolder.getModel(); dlm.clear(); ArrayList<String> tempal = new ArrayList<>(); ArrayList<Anstalld> al = new ArrayList<>(); try { String query = "select aid ...
f8235aec-6ce5-499a-8ac6-12da2c9f6dc8
4
public List getMaps(GameAction gameCode) { ArrayList list = new ArrayList(); for (int i=0; i<keyActions.length; i++) { if (keyActions[i] == gameCode) { list.add(getKeyName(i)); } } for (int i=0; i<mouseActions.length; i++) { if (mouse...
3a35886f-f2e5-439e-bcc4-610eeb81a793
8
private void addWordsFromInputStream(final long inputSize, InputStreamReader input) throws IOException { StringBuilder word = new StringBuilder(); int intChar; int state = LOOKING_FOR_WORD_START; long read = 0; while ((intChar = input.read()) > 0) { if ((read % 50000...
99b9adc1-4094-42ab-861c-8837d181270c
9
private static void parseSpecial(final Map<String, String> args, final CommandLineArguments result) throws ParseException { if (args.containsKey("map_type")) { String map_type = args.get("map_type"); if ("hashmap".equals(map_type)) { result.useTreeMapInsteadOfHashMap = false; } else if ("treem...
89ca41cc-c105-4239-9664-15eabf1db135
7
private final void print2( Object[] kvs) { for( int i=0; i<len(kvs); i++ ) { Object key = key(kvs,i); Object val = val(kvs,i); Object U = Prime.unbox(val); if( key != null && key != TOMBSTONE && // key is sane val != null && U != TOMBSTONE ) { // val is sane String p = (...
2c39ac5d-f9f1-47d9-bcdf-c3f23881d366
8
public boolean isConnected(){ clear(); List<Vertex<T>> vertexes = this.listVertexes(); for(Vertex<T> current: vertexes){ if(current.getStatus() != Vertex.Status.Interpeted){ if(current.getStatus() != Vertex.Status.Used){ current.setStatus(Vertex.Status.Interpeted); } List<Edge> edges =...
277934b0-953c-4054-aecc-cfb4fe7c66d0
9
protected void DBReadAllAreas() { DBConnection D=null; while(CMLib.map().numAreas()>0) CMLib.map().delArea(CMLib.map().getFirstArea()); try { D=DB.DBFetch(); CMProps.setUpLowVar(CMProps.Str.MUDSTATUS,"Booting: Counting Areas"); final ResultSet R=D.query("SELECT * FROM CMAREA"); recordCount=DB.ge...
9cfde1c4-3f1e-497f-8daf-908f9cca1dcc
0
private String getFilenameApd() { String date = fm.format(new Date()); date = "T"+date.replace("-", ""); date = date.replace(":", ""); date = date.replace("|", ""); return date; }
4c6d1f5d-80bd-40fc-9c68-0a717f85082d
1
@Override public void paintComponent(Graphics g) { //TODO: Liste sortiert! for (BufferedImage image : images) g.drawImage(image, 0, 0, null); }
cda7cdd0-8f56-45e3-908a-e8c4b866fad0
3
public void characters(char ch[], int start, int length) throws SAXException { switch (currentElement) { //extracts title of book case TITLE: currentBook.setTitle(new String(ch, start, length)); System.out.println(new String(ch, start, length) + " :: " + currentBook.getTitle()); break; //extrac...
b93f14ee-34e6-4c38-b65d-3928c5075088
4
public void zoomAndCenter() { if (zoomPolicy != ZOOM_POLICY_NONE) { // Centers only on the initial zoom call zoom(zoomPolicy == ZOOM_POLICY_PAGE, centerOnResize || zoomPolicy == ZOOM_POLICY_PAGE); centerOnResize = false; } else if (pageVisible && centerPage) { mxPoint translate = getPageTran...
e6d7fc14-3124-47d5-b83e-b20b446e5324
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { stack[top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { this...
052f6d45-618a-42fe-b161-63be8c530525
6
private void displayMenuManagement() throws Exception { int input; System.out.println("Here you are in the stock management menu :"); System.out.println("1: Add an element"); System.out.println("2: Delete an element"); System.out.println("3: Set an element as broken"); Sy...
0ec8c0a2-2cfb-4b7f-b7c7-070d471f472a
9
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(new Color(1.0f,1.0f,1.0f)); int slotWidth = this.getWidth()/puzzle.getNumColumns(); int slotHeight = this.getHeight()/puzzle.getNumRows(); usedWidth = (this.getWidth()/puzzle.g...
93bcfc31-4df5-4349-872f-b02df7402836
2
@Override public void drawForeground() { String str = "X1." + String.valueOf(x1) + " Y1." + String.valueOf(y1); String str2 = "X2." + String.valueOf(x2) + " Y2." + String.valueOf(y2); addText(10, 70, str); addText(10, 90, str2); int width; int height; if (x2 > x1){ width = x2 - x1; } else { ...
72e31247-3443-41c7-8958-9bfc11721a8b
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
7fb294f7-7b8d-415b-af3b-247d0f3dfb40
8
public static String convertIndexToLetter (int index) { String letter; switch(index) { case 0: letter="A"; break; case 1: letter="B"; break; case 2: letter="C"; break; case 3: letter="D"; break; case 4: letter="E"; break; case 5: letter="F"; break; case 6: ...
1d369940-dad2-4456-80fa-e9c0b886aadf
3
public static String replace(String str, Pattern regex, Replacer replacer){ if(regex==null){ throw new ESTypeException("A regex must be provided"); } if(replacer==null){ throw new ESTypeException("A replacer must be provided"); } Matcher matcher=regex.matcher(str); StringBuffer sb = new StringBuffer()...
072c4e12-a1fb-459f-8971-73a4b6202db1
2
private static void generateProducts() { setProductOfThreeDigitIntegers(new ArrayList<Integer>()); for (int i = 100; i <= 999; i++) { for (int j = 100; j <= 999; j++) { getProductOfThreeDigitIntegers().add(i*j); } } }
35715358-729e-45a7-adfc-23f1bd037499
6
public static double pow(double x, int n) { if (n == 0) return 1; if (x == 0) return 0; boolean pos = true; if (n < 0) { pos = false; n = -n; } double result = 1; double base = x; while (n > 0) { if ((n & 1) == 1) { result *= base; } base...
ec96d146-4079-4b63-b75c-077261d5f5f6
1
public void visitIincInsn(final int var, final int increment) { buf.setLength(0); buf.append(tab2).append("IINC ").append(var).append(' ') .append(increment).append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitIincInsn(var, increment); } }
47fd0ea6-c2ad-4240-bb1f-a280b659a289
0
public RouterPacket GetPacketCreated() { return (RouterPacket)packetCreated.poll(); }
c5ce9932-019f-4c9e-92bf-79f839d47d3c
7
private boolean searchDownForPrevSupersetNode( Node node, K key, Object[] ret ) { while( true ) { // Check if current node is beyond mKey. int c = mComp.compareMins( key, node.mKey ); if( c >= 0 ) { // Descend right subtree if it might have a superset node. ...
b22f7a8f-c9db-458d-9785-c57153ecd8e3
9
final void KA(int i, int i_150_, int i_151_, int i_152_) { anInt6245++; if (i <= 0 && (-1 + anInt6239 ^ 0xffffffff) >= (i_151_ ^ 0xffffffff) && (i_150_ ^ 0xffffffff) >= -1 && -1 + anInt6124 <= i_152_) { la(); } else { anInt6294 = (anInt6239 ^ 0xffffffff) <= (i_151_ ^ 0xffffffff) ? i_151_ : 0; anInt6295 =...
c017e0ff-3763-4986-b2ae-b3f622cf12ba
6
public void incCredits(float inc) { if (Float.isNaN(inc)) I.complain("INC IS NOT-A-NUMBER!") ; if (Float.isNaN(credits)) credits = 0 ; if (inc == 0) return ; final int oldC = (int) credits() ; super.incCredits(inc) ; final int newC = (int) credits() ; if (! actor.inWorld() || oldC == newC) r...
2a0c8536-be47-4c18-ba51-20c707a8d26f
4
public Orientation getOrientationAt(double s){ Point current, next; int i = 0; current = data.get(i); next = data.get(1+i); double length = 0; while (length < s) { length += Math.sqrt((current.getX()-next.getX())*(current.getX()-next.getX()) + (current.getY()...
ce3a668c-8171-4d86-9466-b128f20f6c0a
6
public static void main(final String[] args) { int value = 0; for (int i = 1; i < 10000; i++) { /* For some reason, these numbers screw up the answer - they * are amicable with themselves, not a different number*/ if (i == 6 || i == 28 || i == 496 || i == 8128) continue; if (isAmicable(i)) { v...
3c308820-c797-4c67-9913-2c776f170505
7
private void determineQuadrant() { //Is the bullet on the map? if ( (position.x > Map.WIDTH) || (position.x < 0) || (position.y > Map.HEIGHT) || (position.y < Statusbar.Y_START_POSITION) ) { quadrant = Map.OUT_OF_BOUNDS; return; } if (position.x < Map.HALF_WIDTH) { if (position.y...
de0bf1cc-55c4-4400-8c38-2d43c1abb41f
2
private Integer getIdForNewEntity() throws DaoException { waitCompete(); int maxId = 0; List<T> list = new ArrayList<T>(getEntities().values()); for (T tmpT : list) { if (tmpT.getId() > maxId) { maxId = tmpT.getId(); } } return maxId + 1; }