method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3dba3137-429f-466d-9743-0ad20465070e
1
public void onStop() throws JFException { for (IOrder order : engine.getOrders()) { order.close(); } console.getOut().println("Stopped"); }
2e447c9f-b195-4d81-80d6-b290d95f94c4
9
@Override public void run() { //start(); Packet p_in; while(true) { p_in = null; try { p_in = (Packet) in.readObject(); } catch (IOException ex) { System.out.print("ERR1"); Logger.getLogger(Client...
d724e79e-2969-4446-a89d-72a501ccf248
6
@Override public List<?> asList() { if (obj == null) { return Collections.EMPTY_LIST; } else if (obj.getClass().isArray()) { if (obj.getClass().getComponentType().isPrimitive()) { // Wrapper für primitive Typen, da diese nicht in ein Objekt-Array konvertiert werden können. Object[] wrapper = ne...
91e7dd5b-a03d-4a02-87b8-481a4ea637ca
9
private static Line[] handleGeneralCase(ArrayList<Point> convexHull) { Line[] minRectangle = new Line[4]; Line[] currentRectangle = new Line[4]; int[] hullIndices = { 0, findMin(true, convexHull), findMax(false, convexHull), findMax(true, convexHull) }; int size = convexHull.size(); double minArea; double t...
50f7ba9a-34de-41d2-a009-f22764290ad9
9
public void isValidSolution() { int targetSum = (int) (Math.pow(2, n+1) - 2); for (int i = 0; i < n; i++) { int sumR = 0; int sumC = 0; for (int j = 0; j < n; j++) { sumR+=Math.pow(2, sudokuBoard[i][j]); sumC+=Math.pow(2, sudokuBoard[j][i]); } if (sumR != targetSum) { System.out.print...
e40f4b5d-4ddf-43a4-b35e-08b540b65eca
6
private String getMessage() { if (this.state == InitState.DRUM_MAP) { return "Copying drum-maps to working dir"; } if (this.state == InitState.UNPACK_JAR) { return "Unpacking BruTE"; } if (this.state == InitState.INIT) { return "Init"; } if (this.state == "INSTRUMENT_MAP") { return ...
14b1e8d8-fa19-40e2-9355-c38ea64f0e34
5
public void SQLCreateTableForFirst() { String tname= "profile"; boolean founds=false; try { MyCon = new SQLConnection(); c = MyCon.getConnection("journal"); md = c.getMetaData(); rs = md.getTables(null, null, "%", null); while (rs.next()) { if (rs.getString(3).equa...
706b335e-1aaf-4381-9423-f3ca7bd0f2ec
5
private void init() { if(!source.ready ) return; DataLine.Info info = new DataLine.Info(SourceDataLine.class, source.format); try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(source.format); } catch (LineUnavailableException e) { e.printStackTrace(); return; } catch (Exception ...
e6bf3581-dd83-47ed-8fdb-364f3292d099
6
public boolean isWin(int token) { final int DI[]={-1,0,1,1}; final int DJ[]={1,1,1,0}; for(int i=0;i<3;i++) for(int j=0;j<3;j++) { /* we skip if the token in position(i,j) not equal current token */ if(getBoardValue(i, j)!=token) continue; for(int k=0;k<4;k++) { int ctr = 0; ...
80452b98-4aa4-4558-8214-fe63c68aed88
0
@Test public void testSortMerge(){ sortMergerSort = new SortMergerSort(); List<int[]> arrays = new ArrayList<int[]>(); int[] firstArray = {1,3,5,7,9,11}; int[] secondArray = {2,4,6,8,10,12,14}; arrays.add(firstArray); arrays.add(secondArray); int[] mergerArra...
5b940062-11ae-491a-82ff-20333d03edd8
5
public static boolean isNumberFirst(int numToCheck){ if (numToCheck == 1){ return false; } int[] MFB = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}; int divisor = 0; int i = 0; while ((divisor ^ 2) < numToCheck){ if (i < MFB.length) { ...
b6b9fe98-98f8-41cb-af33-6480f8696389
1
public GsonBuilder getGsonBuilder() { if (gsonBuilder == null) { gsonBuilder = new GsonBuilder(); } return gsonBuilder; }
964a4509-a05a-4f33-abf6-12abdbf6b24f
8
public void createNegativePairsFile(File negativePairsFile, int n) { BufferedOutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream( negativePairsFile)); for (int i = 0; i < n; i++) { os.write(String.format("-1,%d", i + 1).getBytes()); for (Integer pair : createRandomPair...
bb0e697f-8a07-4794-b9d1-d68447acb219
8
@Override public boolean commit(long txnID, long numOfMsgs) throws MessageNotFoundException, RemoteException { if (fileNameTransaction.containsKey(txnID)) { String fileName = fileNameTransaction.remove(txnID); FileContent content = cache.remove(fileName); ReplicaLoc[] locations = null; try { locat...
9a0d98b2-daa5-4b0f-a3b0-b6208d46b927
8
private void updateSelectedChip(String selectedItem) { try { if (!selectedItem.isEmpty()) { ClassRecord classSet = this.directoryClasses.get(selectedItem); String className = classSet.getBaseClass().toString().substring(classSet.getBaseClass().toString().lastIndexOf(' ') + 1); String componentName = ...
72e11547-606f-47c2-befe-a01b73fe6e3f
4
public static void readKeyWord() { try { File file = new File("data/keyword.txt"); if (file.isFile() && file.exists()) { InputStreamReader read = new InputStreamReader( new FileInputStream(file)); BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((line...
4224e78f-42d6-45c3-bd4b-b81c4cb01d3e
2
public FileRef child(String relativePath) { String path = this.path; if (path.equals(".")) { path = ""; } else if (!path.endsWith("/")) { path += "/"; } return new FileRef(this.classLoader, path + relativePath); }
f70657a8-821a-48c4-a557-558e1a2b5991
7
public void main() throws java.io.FileNotFoundException, java.io.IOException { InputProcessor.process(this.m_teams, this.m_sports, this.m_print); for (int i = 0; i < this.m_print.size(); i++) { // If print sport if (m_print.elementAt(i).country < 0 && m_print.elementAt(i).sport ...
b2bb9c48-a9ac-43b5-991a-83193d0865a5
3
@EventHandler public void signEdit(SignChangeEvent e){ plugin.logger.info("Event Triggered"); String[] lines = e.getLines(); Player player = e.getPlayer(); //plugin.logger.info(lines[0]); //plugin.logger.info(plugin.getConfig().getString("kitSignHeader")); //plugin.logger.info(Integer.toString(lines.length...
2b783ee3-7a9e-4b28-9563-2fc674b800f9
9
public boolean processField(final int id) throws NoCleanEquipmentException { boolean fieldProcessed = true; Equipment plow, tractor, seeder, combine; NormalFertilityField fieldToModify = getFieldById(id); // String currentStatus = fieldToModify.getStatus().toLowerCase(); FieldS...
4c1d4cc2-3797-471c-8120-7b9e407ae591
0
@Override public void init(List<String> argumentList) { label = argumentList.get(0); }
3f4d07fa-802e-45e9-8caa-4c46835dfa7c
5
public void renderLevel(Graphics2D g2) { for (Sprite level : game.getGUIButtons().values()) { if (level.getSpriteType().getSpriteTypeID().contains(LEVEL_BUTTON_TYPE)) { // level.setState(pathXTileState.UNSUCCESSFUL_STATE.toString()); SpriteType ...
e8fc8e99-0986-4d38-8a78-241c5b8a84d7
9
final public int writeVarLong (long value, boolean optimizePositive) throws KryoException { if (!optimizePositive) value = (value << 1) ^ (value >> 63); int varInt = 0; varInt = (int)(value & 0x7F); value >>>= 7; if (value == 0) { writeByte(varInt); return 1; } varInt |= 0x80; varInt |= (value...
8ab24921-f8d6-4ce0-a6a4-4866d16899ba
4
private void endImage(String to) { if (to.equals("slide")) slide.addEntity(image); else if (to.equals("quizslide")) quizSlide.addEntity(image); else if (to.equals("scrollpane")) scrollPane.addEntity(image); else if (to.equals("feedback")) quizSlide.addFeedback(image); }
88fd26dc-1da9-49c0-b4f4-4ca5cd31d05c
4
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.delWarp + " (name)"); return; } try { ...
c9c2a2df-d6cf-46f5-ba7d-3b8fbc806be8
8
private void handleResponsePacket(DatagramPacket packet) { try { String strPacket = new String(packet.getData(), 0, packet.getLength()); Log.d(LOG_TAG, "response=" + strPacket); String tokens[] = strPacket.trim().split("\\n"); Log.d(LOG_TAG, "tokens.length=" + tokens.length); String location = null; ...
0eaa4358-23fa-43fd-be9f-8d23a144e122
2
public static boolean isAlphanumeric(String string) { for (int i = 0; i < string.length(); i++) if (!Character.isLetterOrDigit(string.charAt(i))) return false; return true; }
b0c493b4-3075-4507-a2b5-01050dfa4f35
0
public void setColor(VertexColor color) { this.color = color; }
3c63c7c4-d8ca-4690-8784-ef41fe2fc313
4
private boolean isColliding(Vector2 position, int padding){ if(position.x > (x - padding) && position.y > (y - padding) && position.x < (x + padding) + World.current.tileSize/3 && position.y < (y + padding) + World.current.tileSize/3) return true; return false; }
7d984a0a-2cb0-4d4d-bd01-14ac65aa70fb
1
public void setRightChild(Node child){ right = child; if (child != null) { child.parent = this; } }
770968ee-3dcc-4a55-8022-138ad557322b
9
public static Tape getTapeFromFile(File f) throws TuringException, FileNotFoundException { Tape tape = null; Scanner scan = new Scanner(f); int instructionCount=0; try { instructionCount = Integer.parseInt(scan.nextLine()); } catch(NumberFormatException ex) { ...
5cdfdac3-06a2-456c-ae52-a2434d81254e
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...
0ac0192e-b647-47a4-b554-7ebbb873fb31
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
6b8e20d4-f56e-4b5f-b1ea-466a578facbf
0
public List<ProcessedCell> getCells(){ return cells; }
d892c7db-1b97-4e33-b570-ff51de38d7dd
1
public StageShop(StageManager stageManager, Map<String, String> data) { super(stageManager, data); try { background = ImageIO.read(getClass().getResourceAsStream("/graphics/level/background/BlueBackgroundPixel.png")); coin = ImageIO.read(getClass().getResourceAsStream("/graphics/entity/coin/coin.png")); b...
8fc7cdff-5f6c-49e8-90b2-26ba8c833181
5
public static boolean hasLoops( ListNode myList ) { if (myList == null || myList.next == null) return false; ListNode slow = myList; ListNode fast = myList; while (fast.next != null && fast.next.next!=null) { slow = slow.next; fast = fast.next.next; if (slow == fast) return tru...
583a323a-424f-4777-9592-d6d804f1231b
7
private void addAdditionalTravellers(int seats, String nameOfSeats, int customerID) { JPanel cusInputWest = new JPanel(new GridLayout(0,1)); JPanel cusInputEast = new JPanel(new GridLayout(0,1)); //Creates as many textfields as there are remaining seats. JTextField[] ...
26ca87df-15c3-441b-bf27-01ebcd4d9b96
8
private synchronized void toBuffer(int s,Object a){ a1.add(s);a2.add(a); if(s==clear){clearBuffer();} if(s==opaque) theOpaque=(Boolean) a; if(s==setBackground)theBackground=(Color) a; if(inBuffer)return; if(isSetter(s))return; Graphics g=getGraphics(); if(g==null)return; Gra...
c3b56dac-dcbb-40a7-89ea-3d3b2e278de2
9
private void saveScene() { File stdSceneDir = new File("scenes"); if (!stdSceneDir.exists()) { stdSceneDir.mkdir(); } UIManager.put("FileChooser.cancelButtonText", LOCALIZER.getString(L_CANCEL)); UIManager.put("FileChooser.cancelButtonToo...
343da2b4-a7b2-4a8c-be7c-6cb1489804fb
1
private boolean jj_2_45(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_45(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(44, xla); } }
883cc8a6-9b6b-4ec3-a9b2-de9219c0f79c
4
public int isOrdonnancable(List<Tache> taches) { int isOrdo = -1; double U = 0; int nbTachesPeriodiques = 0; for (Tache tache : taches) { if (tache instanceof TachePeriodique) { U += tache.getCi() / new Double(((TachePeriodique)tache).getPi()); nbTachesPeriodiques++; } } if (U > 1) { ret...
f2d3a416-5522-4d0a-8889-eb96c42dc6be
8
@Override public void run() { int n = 0; while (!isBound() && n < 10) { WebServer.logInfo("Waiting for Socket on port " + this.getLocalPort() + " to bind"); try { Thread.sleep(1000); } catch (InterruptedException e) { } n++;...
d6682824-3810-4ded-b6c6-6885271b107a
0
@After public void tearDown() { }
5b5edf81-427e-4697-b486-1eba5bb5d249
2
public static void main(String[] args) { new Timer().schedule(new TimerTask() { @Override public void run() { System.err.println("Aborting"); System.exit(0); } }, 5000); ExecutorService exec = Executors.newCachedThreadPool(); ...
581d083f-090f-4b46-9ed7-975ecf140b5f
2
void setPdomParent(final Block block) { if (pdomParent != null) { pdomParent.pdomChildren.remove(this); } pdomParent = block; if (pdomParent != null) { pdomParent.pdomChildren.add(this); } }
2bd8f597-80bd-4349-8db1-11edcb540deb
7
public static void startupRuleInduction() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ...
bb167c15-c016-4454-bb4e-d02ac87644a8
7
public static Cons yieldConstructorBody(Stella_Class renamed_Class, Cons requiredassignments) { { Cons initialvalueassignments = Stella_Class.yieldInitialValueAssignments(renamed_Class, (Stella_Class.decidedToRecycleP(renamed_Class) ? Stella.KWD_INITIAL_VALUE_ONLY : Stella.KWD_ANY_INITIAL_VALUE)); if ((initi...
c46ff9ed-a6f0-4f95-b1b6-e3451c78e5be
7
final <T> Class<? super T> randomAssignableType(final Class<T> type) { List<Class<?>> list = assignableTo.computeIfAbsent(type, new Function<Class<?>, List<Class<?>>>() { public List<Class<?>> apply(Class<?> t) { return Collections.unmodifiableList(new ArrayList<>(ClassTestUtil.findA...
f69fdb0e-188f-4cb8-9360-23ea9f22266a
8
public boolean scape(ArrayList<AntsPredator> spiders, ArrayList<Food> foods) { Iterator<AntsPredator> spidersIterator = spiders.iterator(); boolean advanceX, advanceY; int velocityY = 1, velocityX = 1; if (spiders.size() > 0) { while (spidersIterator.hasNext()) { AntsPredator spider = spidersIterator.nex...
21addd31-39bb-49ea-b2c0-7f5629f1a93d
3
@Test public void test_getNextPawn(){ assertNotNull(board); board = new Board(2, xSize, ySize, xBonusSquare, yBonusSquare); ArrayList<Pawn> pawns = getAllPawn(board); for (int i = 0; i < pawns.size(); i++) { assertNotNull(pawns.get(i)); } for (int i = 0...
ec09eb2b-c996-4ef8-adc2-524ce38d5e3e
2
public InfoNode SplitLeaf(int key, String value, Node node) { node.add(key, value); LeafNode sibling = new LeafNode(); int mid = (node.getSize()+1)/2; int loopTo = node.getSize(); for(int i = mid; i < loopTo;i++){ sibling.add(node.getKey(i), node.getValue(i)); } for(int i = mid; i < loopTo;i++){ nod...
aa69951a-2105-4cc1-9cab-5eafecb3ac7c
0
public Piirtoalusta getPiirtoalusta() { return this.piirtoalusta; }
f9ee41ce-df58-45c8-be6f-2942f1ef3a8b
7
public void setLocationRelativeTo(Rectangle r) { // Multi-monitor support - make sure the completion window (and // description window, if applicable) both fit in the same window in // a multi-monitor environment. To do this, we decide which monitor // the rectangle "r" is in, and use that one (just pick top-...
bc3931b6-a304-4deb-8949-56d334859ccf
1
@Override public JSONObject getValueForOutput() { try { return this.venue.toJson(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new JSONObject(); } }
ef8ad250-9724-40c1-af0d-e49e56926e47
3
private void mumHelper() { Jokes joke = new Jokes(this.connection, config.getChannel()); try { if (!hasArgs) { connection.msgChannel(config.getChannel(), joke.getMommaJoke(getRandChanUser())); } else { int temp = cmdArgs.indexOf(' '); if (temp != -1) { connection....
be2bbcc0-841c-4249-9d20-f689f3981bf4
4
public static boolean isIntegerInRange(int number, int firstBoundary, int secondBoundary, boolean inclusive) { int minimum, maximum; if (firstBoundary < secondBoundary) { minimum = firstBoundary; maximum = secondBoundary; } else { minimum = secondBoundary; maximum = firstBoundary; } if (inclusi...
95e8e289-20c8-43f3-a4fd-03cf085a6fe0
4
public int getMeterValue(int pos) { if (pos < 1) pos = 1; int meterPos = 1; for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof VMeter) { if (meterPos == pos) { VMeter v = (VMeter) i; return v.amount; }// pos== else { meterPos++; continue; }// else }...
1848cdc0-818a-4cb0-a60b-6aa0f619212a
6
private int findZero(int n, int k) { ArrayList<Integer> nineBase = getNineInvertedDigits(n); for (int i = 0; i < nineBase.size(); i++) { int current = nineBase.get(i); if (i == nineBase.size() - 1 && current == 0) break; if (current == -1) { ...
f23445bd-f02b-487c-86b9-354e9aac8e98
8
public boolean isSatisfied(Tin tin, HashMap<String, Equivalence> equivs) { if(tin.getManu().equals(manu)) { if(tin.getPaintNo().equals(paintNo)) { if(tin.getAcrylic()) { if(acrylic) { return true; } else { return false; } } else { if(enamel) ...
e393aca6-6876-4e74-b7a3-e821344a9e18
8
public boolean similar(Object other) { if (!(other instanceof JSONArray)) { return false; } int len = this.length(); if (len != ((JSONArray)other).length()) { return false; } for (int i = 0; i < len; i += 1) { Object valueThis = this.ge...
697306d6-a171-4949-abf0-ffa0af8c1279
5
private void makeKeywordCSV() { // multi-threaded processing... int processorCount = Runtime.getRuntime().availableProcessors(); ExecutorService executor = Executors.newFixedThreadPool(processorCount); List<UrlKeywordTask> urlKeywordTasks = new ArrayList<>(processorCount); f...
2b049743-5ef6-4c2e-ba43-c7b37e3333b3
3
public synchronized void removeUnsafeToCopyPrivateChunks() { List<String> newChunkType = new ArrayList<String>(); List<byte[]> newChunkData = new ArrayList<byte[]>(); int len = getNumPrivateChunks(); for (int i = 0; i < len; i++) { String type = getPrivateChunkType(i); char lastChar = type.charAt(3); ...
118e7a37-9d83-4ba1-aaa5-e37c0d216f65
0
private void bmhashdisplay() { hashTable.display(); } // end dmhashdisplay()
46817b5d-44d8-42a5-b01f-2faf1647fe23
3
public int getQuantity(int size){ switch(size){ case(1):return small; case(2):return med; case(3):return large; default:return 0; } }
e21f700e-f65b-468a-a5e7-1a2a05aa4cad
0
public void setUp() { trie = new Trie(); }
e6932240-b04f-4a3a-bbd7-280373ff7985
6
public ArrayList<String> getGlobicProperties(String filename) { ArrayList<String> globicProperties = new ArrayList<String>(); Document doc = (Document) session.getObjectByPath("/" + filename); List<Property<?>> properties = doc.getProperties(); for (Property<?> p : properties)...
b4eb77c0-4f69-4259-841a-7ea8278d64fe
4
public Chunk[] split(int d) { int cutoff = (classes.length / d); if (cutoff <= 0) { cutoff = 1; } LinkedList<Chunk> chunks = new LinkedList<>(); ArrayList<ClassNode> list = new ArrayList<>(); for (ClassNode c : classes) { list.add(c); if (list.size() == cutoff) { chunks.add(new Chunk(list.toArr...
99b1eb59-fabe-463f-bc40-b1ac09425f25
4
public static void changeMemberTelNR(String telNR, int memberID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit...
3d504327-1f6e-4a74-a0bf-62bfa3694518
4
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Space Shooter Game"); frame.addKeyListener(keyControl); frame.addWindowListener(windowControl); frame.setResizable(false); ...
45226a64-6c3f-429e-9c5a-617dd875f196
3
private void writeDegrees() throws IOException { DataOutputStream degreeOut = new DataOutputStream(new BufferedOutputStream( new FileOutputStream(ChiFilenames.getFilenameOfDegreeData(baseFilename, useSparseDegrees)))); for(int i=0; i<inDegrees.length; i++) { if (!useSparseDeg...
610d4743-d4a8-4e9f-b9ec-5d2ef6b4ce64
7
private XmlAction createHookNodeUndoAction(MindMapNode focussed, List selecteds, String hookName) { CompoundAction undoAction = new CompoundAction(); HookNodeAction hookNodeAction = createHookNodeAction(focussed, selecteds, hookName, null); ...
bd71bd71-de23-4069-bdd5-ff8affb73c6d
4
public void refreshNotificaion() { try { // check user isRemoving if(this.isRemoving()) { UserRemovalInitiated notification = new UserRemovalInitiated(this); Notification.add(this.getId(), notification); } // check venue isRemoving List<Venue> aVenue = Venue.createFromResultSet(Data._find...
01649a9e-78ff-42c0-b436-1f4e35777493
2
@FXML protected void addFiles(ActionEvent event) throws Exception { final FileChooser fileChooser = new FileChooser(); List<File> list = fileChooser.showOpenMultipleDialog(currentStage); if (list != null) { for (File file : list) { addFileToList(...
be570011-b324-4636-aaec-93ab398a6e4d
7
public void landet(Spiller sp) { sp.besked("Du er landet p "+navn); if (sp==ejer) { // eget felt sp.besked("Det er din egen grund"); if (antalHuse<5 && sp.konto>huspris && // bemrk: kun hvis betingelserne sp.sprgsml("kbe hus for "+huspris))// er opfyldt stilles sprgsmlet { // by...
e7584885-22d7-42b5-b1cc-fa9af93afd0c
7
private Entry<K, V> getEntry(Object key) { if (size == 0) { return null; } int hash = key == null ? 0 : key.hashCode(); int index = hash % table.length; for (Entry<K, V> entry = table[index]; entry != null; entry = entry.next) { if (hash == entry.hash && (...
fccbc091-e8a1-48ab-b907-f71814ed71af
8
synchronized void applyBoundary() { int iAtom = model.iAtom; float radius = 0; Atom a = null; for (int i = 0; i < iAtom; i++) { a = atom[i]; if (!a.isMovable()) continue; radius = 0.5f * a.sigma; if (a.rx > xbox - radius) { a.vx = -Math.abs(a.vx); } else if (a.rx < radius - xbox) { ...
a5847b09-aecb-4634-8333-1f2a66271721
5
public static boolean isMounted(File mountPath) { if (Environment.isWindows()) { File[] roots = File.listRoots(); for (File f : roots) if (f.getAbsolutePath().charAt(0) == mountPath.getAbsolutePath().charAt(0)) return true; return false; // mountPath.exists(); } try { Process child = Ru...
4a870a10-0156-4f77-ae18-101e060f4a2e
8
public void listProducts() { products = new ArrayList<Product>(); try { ResultSet results; if (listAllProducts) { results = listAllProductsStatement.executeQuery(); } else { listByCustomerStatement.setString(1, customerLogin); results = listByCustomerStatement.executeQuery(); } while (r...
4af0656f-0ad0-4518-b1e3-c361607be203
7
@Override public void update(IObservable ui) { if (!tablecards.initDone()) { tablecards.init(ui.getUIData().getPlayers().length); } if (scores.notInitialized()) { scores.initTable(ui.getUIData()); } // shortcut UIDataInterface d = ui.getUIData...
2f9ffa1e-0e93-461b-a12f-9909641e3141
8
public static boolean unitIncludedInOtherUnitsP(TranslationUnit unit) { { MethodSlot method = null; if (!(unit.category == Stella.SYM_STELLA_METHOD)) { return (false); } else { { method = ((MethodSlot)(unit.theObject)); if (((BooleanWrapper)(KeyValueList.dynami...
d9e32226-ee49-41a2-9cda-0cc12ab5fa4c
0
public void onEnable() { checkvault();// Ƿvault setupPermissions();// vault Ȩ setupEconomy();// vault this.log = getLogger(); pm = this.getServer().getPluginManager(); configmanager = new ConfigManager(this); saveConfig(); loadAccessCommands(); // ļлȡھʹõ setupHeroes();// heroes arenas = new Has...
29ea3284-3be6-47f3-9cf4-57db90734b85
5
public static boolean isFileLocked(String filename) throws SwingObjectException { boolean isLocked=false; RandomAccessFile fos=null; try { File file = new File(filename); if(file.exists()) { fos=new RandomAccessFile(file,"rw"); } } catch (FileNotFoundException e) { isLocked=true; }catch (Excep...
ee76fc8f-4ef4-4038-bf85-caad455150ce
3
private void openSocket(MailAccount account) { sTrace.debug("open Socket for Account " + account.userName); try { /* Socket erzeugen --> Verbindungsaufbau mit dem Server */ clientSocket = new Socket(account.serverAddress, account.portNo); sTrace.debug("socket opened for " + account.userName + " on Port " ...
2547187f-ab8c-4de1-95e8-9067ecf1ccd9
9
public void removeEntry(String firstColumnValue) { boolean removed=false; int rowNumber=0; for (int i = columns.size(); i < cells.size(); i+=columns.size()) { if(cells.get(i).getText().equals(firstColumnValue)){ removed=true; rowNumber=i; } } if(removed){ int numberOfCells = cells.size(); ...
c7e0e78e-e7ad-437b-814a-de9094b8819d
4
public void doPost(HttpServletRequest request, HttpServletResponse response) { //request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out=null; DButil db=new DButil(); try { out = response.getWriter(); }catch...
96e02be6-5ba3-4eb7-b630-1324f01a5973
8
private String parseIdentifierInternal() { final boolean quoted = string.charAt(position) == '"'; if (quoted) { final int endPos = string.indexOf('"', position + 1); final String result = string.substring(position, endPos + 1); position = endPos + 1; ret...
7bf332c4-b7d7-4504-a7be-29c98d06f9fd
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PlayerMatchesID other = (PlayerMatchesID) obj; if (matches == null) { if (other.matches != null) return false; } else if (!matches.equal...
a587e549-223e-43e8-a75c-70395cfcc8c0
9
@EventHandler(priority = EventPriority.HIGHEST) //On craft public void onCraft(CraftItemEvent ci){ //Getting the data value String data = ci.getCurrentItem().getData().toString(); Player player = (Player)ci.getWhoClicked(); int endIndex = data.indexOf("("); String replacement = ""; String toBeReplaced = dat...
dd19e356-90c8-428b-8ec6-9cbee7e653be
2
private static Drug getDrug(Drug bean, PreparedStatement stmt, ResultSet rs) throws SQLException{ if(bean.getDrugId()!=0) stmt.setInt(1, bean.getDrugId()); else stmt.setString(1, bean.getDrugName()); rs = stmt.executeQuery(); if (rs.next()) { Drug newBean = new Drug(); newBean.setDrugId(rs.get...
cc7351a2-dfa2-496e-ba74-b1e7460feba0
1
public static HashMap<String, Integer> fillAccessExceptionMap(String[] cmdInfo) { HashMap<String, Integer> accessExceptionMap = new HashMap<String, Integer>(); for (int i = 3; i < cmdInfo.length; i++) accessExceptionMap.put(cmdInfo[i].substring(1).toLowerCase(), Integer.parseInt(cmdInfo[...
b9846e36-03e2-4343-b105-76074b598eed
2
public static String secondsToHour(int time) { if (time < 0) return null; int hours = (time / 3600) % 12; String hoursStr = hours == 0 ? "12" : hours + ""; return new String(hoursStr); }
91243523-e1cd-401e-bffb-7c55a33fa59e
2
public E getIndice(String pIndex){ E resp = null; for (Nodo<E> i = cabeza; i != null; i = i.getSiguiente() ) if(i.getIndex() == pIndex) resp = i.getDato(); return resp; }
13df9056-1871-4314-8d54-a8c8d858659d
0
public getNow() { this.info = "get server time"; }
5d26727e-9160-4298-bcdf-f80a9ead57d7
1
public boolean isAccept() { if (getUnprocessedInput().length() != 0) return false; State s = getCurrentState(); Automaton a = s.getAutomaton(); return a.isFinalState(s); }
5b74acac-86f6-46f5-a8f7-651ba841af71
9
private void drawWalls( Graphics2D wallG, int originX, int originY, SavedGameParser.ShipState shipState, ShipLayout shipLayout ) { Color prevColor = wallG.getColor(); Stroke prevStroke = wallG.getStroke(); Color floorCrackColor = new Color(125, 125, 125); Stroke floorCrackStroke = new BasicStroke(1); Color r...
ad135b6b-9ea1-4045-a4a3-b1b942e0f8d9
5
private void verify() { if(!input.isEnabled()) { return; } String text = ((JTextField) input).getText(); if(text.length() == 0) { return; } boolean valid = false; try { BigInteger value = new BigInteger(input.getText(...
7a761faf-e063-4b15-b7f5-6a8fc3724516
3
@Override public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { if (cs instanceof Player) { final Player player = (Player) cs; if (DatabaseHandler.isPremium(player)) { if (args.length == 1) { final String name = args[0]; player.setDisplayName(name); //TODO SE...
5e055924-4523-490e-aca9-e6dd7d3770f4
7
public List<OrganismTree> step(int generationNum) throws DeepCopyException { Random r = new Random(); nextGen.clear(); List<OrganismTree> currentGeneration = OrganismRepository.getInstance().getGeneration(generationNum); Collections.sort(currentGeneration); int numElites = populationSize*elitePercent...
4d5f5b16-38bd-4882-852a-4fad2918bb8d
6
public void downloadFile(final URL downloadURL, final File pathToDownload) throws IOException { if (mainWorker != null && !mainWorker.isCancelled()) { textArea.append("Downloading newest pack...\n"); if (currVer == 0) { getLatestVersionFromURL(new ...
76a88fb8-d0de-418d-a6e5-e7f2dcefa6b5
9
public String convert(String s, int nRows) { if (s == null || nRows < 1) { return null; }; if (nRows == 1) { return s; } List<StringBuilder> lines = new LinkedList<>(); for (int i = 0; i < nRows; i ++) { lines.add(new StringBuilder());...