method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e4426c7c-45dc-4442-8aca-79b034733779
6
public static <T extends Comparable<? super T>> Pair<T> getMinMax(T[] data) { if (data == null || data.length == 0) { return null; } T min = data[0]; T max = data[0]; for (int i = 1; i < data.length; i++) { if (min.compareTo(data[i]) > 0) { ...
c5113dd0-78e5-425d-b182-eb674dd955c0
3
public static ActionCommand defineCommand(SessionRequestContent request){ String action = request.getParameter("command"); if (action == null || action.isEmpty()) { return new EmptyCommand(); } ActionCommand current; try { CommandEnum currentEnum...
bcbbb6a9-2bbc-4566-9bf1-33b489cac58e
4
private void historyBack(int a) { if ( myThread.isPaused () ) { if ( a != moveStorage.size () - 1 ) { undoUntilButton.setText (UNDO_UNTIL_BUTTON_TEXT); undoUntilButton.addMouseListener (undoUntilButtonListener); undoUntilButton.setVisible (true); undoButton.setVisible (false); ...
42fe5cbd-438c-41a0-9fc4-3768b4ec4236
3
@Override public boolean isSolution() { int value = 1; int size = width * height; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if (board[y][x] != value) { return false; } value = (value + 1) % size; } } return true; }
64fee6b2-e69b-4126-ba65-780fd367b4c2
9
@Override /** * Add an actor to the ActorSet, assigning it an ActorId if one isn't already set */ public boolean add(Actor a) { if (playerId != 0) { // Restrictive actor creation on network client if (a instanceof actor.ship.PlayerShip && a.id == null && ((actor.ship.PlayerShip)a)....
f28c69c9-5e84-403f-a95d-4d808b7106ba
2
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened try { List<projetrf.model.Ville> vv1 = RequetesVille.rechercheVilleByCp(jTextFieldCommercialCp.getText().trim()); jComboBoxCommercialVille.removeAllItems(); for (Vil...
1b14027c-35a1-43d1-b34a-94449d15d384
9
protected void setGenMobAbilities(MOB M, List<XMLLibrary.XMLTag> buf) { final List<XMLLibrary.XMLTag> V=CMLib.xml().getContentsFromPieces(buf,"ABLTYS"); if(V==null) { Log.errOut("CoffeeMaker","Error parsing 'ABLTYS' of "+identifier(M,null)+". Load aborted"); return; } for(int i=0;i<V.size();i++) { ...
00fa5e28-e367-467b-b002-8ef13a7aba8a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PongMessage other = (PongMessage) obj; if (correlationId == null) { if (other.correlationId != null) return false; } else if (!correlati...
060f7fa9-8b16-44f6-8506-b08046351206
4
private int jjMoveStringLiteralDfa27_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 26); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 26); } switch(curChar) { case 50: return jjMoveStringLiter...
b55c49fb-b75c-4837-b173-2dff67064529
3
@Override public void run() { while (true) { try { while (true) { Thread.sleep(20000); dbConnect("jdbc:jtds:sqlserver://localhost/CCM0300", "mourad", "anis@@ct"); } } catch (InterruptedException e...
f221602a-13be-4558-bbfc-3bbf9863cba8
0
public void setFileHandler(FileHandler fileHandler) { this.fileHandler = fileHandler; }
46e765bd-d808-4f9a-b836-2c36f07d99c4
1
static synchronized public FactoryRegistry systemRegistry() { if (instance==null) { instance = new FactoryRegistry(); instance.registerDefaultFactories(); } return instance; }
f3b5eb90-16d6-4730-9e04-f3167690d44b
5
private void broadcast (int udpPort, DatagramSocket socket) throws IOException { ByteBuffer dataBuffer = ByteBuffer.allocate(64); serialization.write(null, dataBuffer, new DiscoverHost()); dataBuffer.flip(); byte[] data = new byte[dataBuffer.limit()]; dataBuffer.get(data); for (NetworkInterface iface : Coll...
b9de76b8-8972-45ab-92a8-93039695b6b1
7
LoginDemo() { setTitle("Login Form"); setLayout(null); label1 = new JLabel(); label1.setText("Username:"); text1 = new JTextField(15); label2 = new JLabel(); label2.setText("Password:"); text2 = new JPasswordField(15); SUBMIT = new JButton("SUBMIT"); label1.setBounds(350, 100, 100, 20); ...
2ef68120-779d-4cef-a662-fca83a4df151
6
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case VENDOR: return String.class; case NUMBER: return Integer.class; case MODEL: return String.class; case NOTE: ...
5eb68c0d-ad9a-40b9-8d4e-fa4625a2d9c8
8
public void Update() { if (PlayerCollision(Game.GetCurrentWorld().GetCurrentPlayer()) && !enterWarp) { enterWarp = true; transID = TransitionHandler.AddTransition(0, 2000); } if (transID != -1) { if (TransitionHandler.GetTransition(transID).IsComplete() && enterWarp) { if (!worldWarp) { if (Pla...
1183c059-371a-4d98-b6e1-fa9abe34088d
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
0ae30993-56c1-42fd-9bbd-6e2ca7b81942
2
public void processMessage(Message msg) { network = UserManager.networkMap.get(this); if (msg.getContents().startsWith("PING :")) { network.addOutboundMessage(Message.createClientMessage(null, String.format("PONG %s", msg.getContents().substring(6)))); } else if (msg.getContents().startsWith("376")) { n...
3c02703d-e76a-48d6-bbcb-80f5771ed857
6
public void overwriteTRNS(byte r, byte g, byte b) { if (hasAlphaChannel()) { throw new UnsupportedOperationException("image has an alpha channel"); } byte[] pal = this.palette; if (pal == null) { transPixel = new byte[]{0, r, 0, g, 0, b}; } else { ...
4b32d97d-fe54-4c30-9001-b515b0657b11
9
static void skipWhitespace(IXMLReader reader, StringBuffer buffer) throws IOException { char ch; if (buffer == null) { do { ch = reader.read(); } while ((ch == ' ') || (ch == '\t') || (ch == '\n')); } else { for (;;) { ...
52029ae8-81b9-467a-b5cd-e0ba53b3bbd5
9
private int jjMoveStringLiteralDfa6_1(long old0, long active0) { if (((active0 &= old0)) == 0L) return 6; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return 6; } switch(curChar) { case 73: case 105: return jjMoveStringLiteralDfa7_1(active0...
d5a1b9fb-3624-40a4-85d0-ad7d9fb780f8
5
public void actionPerformed(ActionEvent e) { String actionCommand = e.getActionCommand(); if (e.getSource() instanceof JButton) { if ("Add".equals(actionCommand)) add(); if ("Subtract".equals(actionCommand)) subtract(); if ("Multiply".equals(actionCommand)) multiply(); if ("Divide".equals(ac...
11e90bf1-f61e-4c4a-a343-22f2412f5b43
3
private void terminate(){ int workerId; Message tmntCommand = new Message(Message.msgType.COMMAND); tmntCommand.setCommandId(CommandType.SHUTDOWN); Set<Integer> workerIdSet = processServerMap.keySet(); Iterator<Integer> workerIterator= workerIdSet.iterator(); /*shut down ...
fc4ae63a-4df3-419f-bc45-95a4f6686646
5
@SuppressWarnings("unchecked") @Override public String displayQuestionWithAnswer(int position, Object userAnswer) { String questionStr = (String) question; ArrayList<String> answerList = (ArrayList<String>) answer; ArrayList<String> userAnswerList = (ArrayList<String>) userAnswer; boolean correct = false; i...
d5d6b3e1-e432-46c7-9475-732cd28e7111
8
@Override public void command(String command) { System.out.println("Dispatch " + command); if(command == null){ return; } OUTER: for(Robot robot : _robots) { System.out.println(robot.getClass().getSimpleName()); Class robotClass = robot.getClass();...
63c40d69-6a77-4c22-9e0a-baa04f5c7a94
9
public final static void cut3(String srcImageFile, String descDir, int destWidth, int destHeight) { try { if(destWidth<=0) destWidth = 200; // 切片宽度 if(destHeight<=0) destHeight = 150; // 切片高度 // 读取源图像 BufferedImage bi = ImageIO.read(new File(srcImageFi...
38742436-1964-4f4f-afa3-7ca45644a539
6
@Override public Color getDominantClusterInNeighbourhood(Node node) { Set<Node> neighbors = IteratorUtils.toSet(this.LPAClusteringEngine.getGraph().getNeighbors(node).iterator()); if (neighbors.isEmpty()) return this.LPAClusteringEngine.getNodeClusterMapping().get(node); // no c...
18fc4a85-0c1b-413f-a0ed-fb2fa0bd0350
6
public static Object defaultValueOfType(String type){ type = parseType(type); if(StringUtils.isBlank(type)){ throw new InvalidParameterException("empty param type"); } if("String".equals(type)){ return "\"\""; }else if("int".equals(type)){ retu...
39b2de69-5487-4d37-ab31-a69dd52775e1
1
public int hashCode() { return (this.getValue() == null) ? 17 : this.getValue().hashCode(); }
38a055e5-07e9-4f5f-9d65-79e1094ecb5e
9
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Set up first layer int buttonHeight = this.getHeight(); int buttonWidth = this.getWidth(); Color topColoring; ...
8245061b-7e59-4e63-a80f-ad13bab63ec2
0
public int getPort() { return mPort; }
68a121d7-dcae-4f55-9dcb-5b7d5f4a43c5
1
ArrayList<Schedule> geneticAlgorithm(ArrayList<Schedule> schedule, double crossoverProb, double mutationProb, int generations, int population){ ArrayList<Schedule> chromosomes; ArrayList<Schedule> solution = new ArrayList<>(); for(int a=0; a<generations; a++){ chromosomes = fitnessCa...
3ad464ef-f0d4-4fee-9a15-6428ca356df7
2
double[] asswght(int R[], int RMax, int s) { double P[] = new double[s]; double sum = 0; for (int i = 0; i < R.length; i++) { sum += R[i]; } for (int i = 0; i < s; i++) { P[i] = (RMax - R[i] + 1) / ((double) (RMax + 1) * s - sum); } return ...
6d836811-ff4e-4de1-9955-493f334ddf9a
1
public MyScroller() { try { font = Font.createFont(Font.TRUETYPE_FONT, ClassLoader.getSystemResourceAsStream("terminal.TTF")); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(font); } catch (Exception e) ...
288159d6-4b39-4545-9c9d-4504a0f79fc7
3
public void saveWorld(boolean var1, IProgressUpdate var2) { if (this.chunkProvider.canSave()) { if (var2 != null) { var2.func_594_b("Saving level"); } this.saveLevel(); if (var2 != null) { var2.displayLoadingString("Saving chunks")...
5189e256-2581-4381-9680-03ad959fb4eb
1
public void calculateNewScores(int intervalCurrent, int intervalMax) { for (Score score : scores) { score.recalculate(intervalCurrent, intervalMax); } }
ed2d2723-1d1b-467c-b219-147d35e51cc2
7
public static String optimizeText(String text) { char buf[] = text.toCharArray(); boolean endMarker = true; for (int i = 0; i < buf.length; i++) { char c = buf[i]; if (endMarker && c >= 'a' && c <= 'z') { buf[i] -= 0x20; endMarker = false; ...
2d4bf636-d4c4-4477-8c03-d72cef3526d6
7
public Set<Map.Entry<Character,V>> entrySet() { return new AbstractSet<Map.Entry<Character,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TCharObjectMapDecorator.this.isEmpty(); } p...
9ffa0e2e-7596-44b7-9456-5f9e1fb94811
9
@Override public void run() { while (isWriter) { int i; int j; synchronized (this) { if (buffIndex == writeIndex) { try { wait(); } catch (InterruptedException interruptedexception) { } } if (!isWriter) { return; } j = writeIndex; if (buffIndex >= writeIndex...
0409246f-ae39-472c-afc7-89b95c28600c
5
private void sendProposal() { if (allPlaces.isEmpty()) { logger.log(Level.INFO, (teacherSymbol + ": search new place, allPlaces is empty")); sendRejectProposal(); myAgent.removeBehaviour(this); return; } Place place = allPlaces...
f3d24c8c-3d4f-4576-a0d1-bc1b5a4eb5d5
4
public void readTable(Map table) { if (parent != null) setAlias((String) table.get(getFullName())); for (Iterator i = loadedClasses.values().iterator(); i.hasNext();) { Identifier ident = (Identifier) i.next(); if ((Main.stripping & Main.STRIP_UNREACH) == 0 || ident.isReachable()) ident.readTable(...
560049dd-4890-4579-a500-fa9fb5414ee3
5
public Edge[] nodeConnectionHelper(Node parent, Node from, Node to) { if (from == to) return new Edge[0]; for (Node n : from.adjNodes()) { if (n != parent) { Edge[] temp = nodeConnectionHelper(from, n, to); if (temp != null) { Edge[] ret = new Edge[temp.length + 1]; ...
6e4e1a17-45fd-4688-9dfb-7323fd61e5b4
3
public static String StrFill(String fillStr ,String oldStr ,int length ,String place) { StringBuffer sb = new StringBuffer(); if("right".equals(place)){ sb.append(oldStr); } for(int i=0; i < (length - oldStr.length());i++){ sb.append(fillStr); } if("left".equals(place)){ sb.append(oldStr); } ...
13775602-99bf-48e7-852f-2b8412de15d6
9
public OBJModel(String fileName) { positions = new ArrayList<Vector3f>(); texCoords = new ArrayList<Vector2f>(); normals = new ArrayList<Vector3f>(); indices = new ArrayList<OBJIndex>(); hasTexCoords = false; hasNormals = false; BufferedReader meshReader = null; try { ...
6582b914-db2b-4c01-84c6-22216dc22caf
0
public static void selectNone(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { tree.setCursorPosition(0); tree.getDocument().setPreferredCaretPosition(0); tree.setComponentFocus(OutlineLayoutManager.TEXT); tree.clearSelection(); layout.draw(currentNode,OutlineLayoutManager.TEXT); }
33f84f9e-3924-4164-b19d-654e23ee1e7f
7
public static Cons clTranslateNthTree(Cons tree) { { Symbol operator = null; Surrogate owner = null; Cons arguments = null; { Object [] caller_MV_returnarray = new Object[2]; operator = Cons.destructureCallTree(tree, caller_MV_returnarray); owner = ((Surrogate)(caller_MV_returnar...
6d8dfc9f-ae62-4953-b527-02f81cf4cd92
8
public void paintComponent(Graphics g) { x_cord = 40; y_cord = 40; // could have taken height as well as width // just need something to base the roomsize roomSize = (width - x_cord) / width + 30; // temp variables used for painting int x = x_cord; int y ...
9b6d8785-7e78-4c81-8c4c-a55b3d5dce57
7
public void setHeader(File file, String[] header) { if (!file.exists()) { return; } try { String currentLine; StringBuilder config = new StringBuilder(""); BufferedReader reader = new BufferedReader(new FileReader(file)); while ((currentLine = reader.readLine()) != null) { config.append(curr...
83dd0c65-51e3-4e1f-9933-dd29e8cab830
0
@Override public String describeNode() { return this.getFrameIdentifier();//+(this.nativeValue==null?"":"="+this.nativeValue); }
cb9d5d27-900e-41fe-a7fe-b4d3246dcfaf
5
private void editarEquipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editarEquipoActionPerformed int count = 0; int index = 0; int index2 = -1; JDialog editEquipo; String nTeam = teamList.getSelectedValue().toString(); for (int i = 0; i < pilotos.s...
72dffc24-2f34-41be-838a-838a8a7a65c7
7
@Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); sb.append("\nTransport list:\n"); List<Transportable> carrying = new ArrayList<Transportable>(); List<Transportable> carried = new ArrayList<Transportable>(); for (Transportable t : t...
f0825c0f-4f25-4d7c-a0ef-046c6f666d39
8
public String Capslock(Player player, String message) { int countChars = 0; int countCharsCaps = 0; if (!player.hasPermission("warhub.moderator")) { countChars = message.length(); if ((countChars > 0) && (countChars > 8)) { for (int i = 0; i < countChars; i++) { char c = message.charAt(i); St...
cad27bcb-46e1-4359-9407-270a631c17c4
6
public final SymbolraetselASTSolver.start_return start() throws RecognitionException { SymbolraetselASTSolver.start_return retval = new SymbolraetselASTSolver.start_return(); retval.start = input.LT(1); List list_constraints=null; RuleReturnScope constraints = null; try { ...
9b8c48d2-1dd1-4864-bb0f-50fe607ecebd
2
private void scaleImage() { setProgress("Scaling..."); new SwingWorker<BufferedImage, Object>() { BufferedImage image = controller.getImageBean().getImage(); double scale = (double)controller.getParametersBean().getResolution()/image.getWidth(); @Override protected BufferedImage doInBackground() thr...
681d7876-6bc4-47e9-8f69-27d308f9cffa
5
public boolean remove(Task task) { if (task == null) { for (int index = 0; index < size; index++) if (tasks[index] == null) { fastRemove(index); return true; } } else { for (int index = 0; index < size; index++) if (task.equals(tasks[index])) { fastRemove(index); return true; ...
e2f39420-097e-4ec1-90bf-eb414b86bb5c
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...
57f45725-a1e8-4901-a3f2-96a893d44599
1
public Item next() { if (!hasNext()) throw new NoSuchElementException(); Item item = current.item; current = current.next; return item; }
59b405d6-2d92-4678-8a2b-828f8bfe1706
0
protected Automaton getAutomaton() { return automaton; }
361e064a-bf8f-4bfb-9507-046cfdad24da
6
public JMacroWindow() { mode = RunModes.Continuous; showConsole.addActionListener(e -> { if (showConsole.getText().equals("Show Log")) { Console.start(); showConsole.setText("Hide Log"); } else { Console.stop(); showConsole.setText("Show Log"); } }); editData.addActionListener(e -> { if...
b19dab98-417b-46b4-a5ba-ed2735e89181
6
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return invokeImpl(proxy, method, args); } catch (TargetError te) { // Unwrap target exception. If the interface declares that // it throws the ex it will be delivered. If not it will be // wrapped in an Undec...
2faa018c-bcca-45b6-b396-dffc768ea7d6
4
@Override public void init() { super.init(); // -114, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // old frtHeader //-112, 0, 0, 0, == 144 // An unsigned integer that specifies the total number of table styles in this document. This is the sum of the standard built-in table styles and all of the custom table styles. T...
f8dc24e5-c9c1-403b-923b-cc6c604a482f
8
protected void paintComponent (Graphics g) { super.paintComponent(g); squareWidth = boardWidth / (squares.size()/4 + 1); squareHeight = boardHeight / (squares.size()/4 + 1); //4 and 25 for the title bar and left hand side space cSPosX = 0; cSPosY = 0; mCSPosX = cSPosX ; mCS...
c5fbd51f-7663-4772-b11c-27290d0d8b14
9
public Matrix solve (Matrix B) { if (B.getRowDimension() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!this.isNonsingular()) { throw new RuntimeException("Matrix is singular."); } // Copy right hand side with pivoting int n...
3dcc0b18-52ea-4bb1-8fc9-56a24a87bfa9
6
public void callCheat(int reason) throws IOException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException { System.out.println("Cheater Detected!"); switch (reason) { case PUBLIC_KEY_CHANGED: System.out .println("Reason: Someone has attempted to change yo...
58d242aa-d6a3-490f-a6bf-468c58e0ba7d
4
public static double fDistributionInverseCDF(int nu1, int nu2, double prob) { if (prob < 0.0 || prob > 1.0) throw new IllegalArgumentException("Entered cdf value, " + prob + ", must lie between 0 and 1 inclusive"); double icdf = 0.0D; if (prob == 0.0) { icdf = 0.0; } else { if (prob == 1.0) { icdf =...
a70d7652-3f60-485a-b4b4-4e18e2d5b8a5
1
public void testNormalizedStandard_periodType_yearMonth2() { Period test = new Period(Integer.MAX_VALUE, 15, 0, 0, 0, 0, 0, 0); try { test.normalizedStandard((PeriodType) null); fail(); } catch (ArithmeticException ex) {} }
0df6cb43-640d-4048-a488-68f67e40c089
7
private int get_prev_page(Page page) throws SoundException { long begin = offset; //!!! int ret; int offst = -1; while (offst == -1) { begin -= CHUNKSIZE; if (begin < 0) { begin = 0; } seek_helper(begin); while (...
2e21580e-38cd-464b-8d2b-90703c4c312f
4
public static Class<?> preLoader(File file, String className) { try { String jar = file.getAbsolutePath(); // We generate a jar from that class file if(parsingType.equals("class")) { jar = generateJar(file); } // Convert File to a URL URL url = new URL("file:" + jar); URL[] urls = new URL[]...
7a511829-4bb1-4ff5-8b6f-2ec8c0053c68
1
public Set propagateUsage() { used = new SimpleSet(); Set allUse = new SimpleSet(); Set childUse0 = subBlocks[0].propagateUsage(); Set childUse1 = subBlocks[1].propagateUsage(); /* * All variables used somewhere inside both sub blocks, are used in this * block, too. Also the variables used in first bloc...
d72d7776-0a9f-4174-87ea-81ad0a2419fd
5
public double sin(int a){ //normalizing if(a>360){ a %= 360; }else if(a<0){ a %= 360; a += 360; } //return if(a <= 90){ return sin[a]; }else if(a <= 180){ return sin[180 - a]; }else if(a <= 270){ return -sin[a - 180]; }else{ return -sin[360 - a]; } }
b9e04f0f-1a9b-400a-b116-477783f922e2
0
@Override public void actionPerformed(ActionEvent e) { AlgorithmInterface.getAlgorithm().singleStep(); }
493ccf3a-9291-45d9-b797-d63b66671589
3
private final void removeFirst() { if (this.head == this.tail) { return; } if (length() == 1) { this.head = StringBuilder.PATTERN_SIZE; this.tail = StringBuilder.PATTERN_SIZE; return; } if (++this.head == this.content[this.cIdx].length) { this.head = 0; } }
ef759ce4-aa85-4ae9-87f0-ec3b4d972663
6
public static void startupPrint() { { 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$, ((Module...
e5d15e77-bfa8-4a96-9c3c-7578e778a9c2
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof SlippingCarriage)) return false; SlippingCarriage other = (SlippingCarriage) obj; if (bedCount != other.bedCount) return false; return true; }
c18c2cfb-c1bc-4f79-b301-3893f354dc40
4
public static Node sort(Node head) { //Since modifying stuff causes all instances to be modified, we need duplicates to be stored that are immutable final Node h = copy(head); final Node h3 = copy(head); if (head == null || head.next == null) return head; // count tot...
d5bcdaa5-d16d-4533-83ce-06dba7a5f268
2
public static void setup() { // Construct the setup frame final JFrame setup = new JFrame("Welcome!"); setup.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent pane = (JComponent)setup.getContentPane(); pane.setLayout(new BorderLayout()); pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)...
c496a9d6-8ddd-441c-a3b9-ba4376600261
4
public String setProperty(String name, String value) { String oldValue = getProperty(name); if (value == null) return (String) properties.remove(name); else if (oldValue == null) return (String) properties.setProperty(name, value); else if (value.isEmpty() && !oldValue.isEmpty()) return null; else ...
ae6f6e25-5325-4496-8b4f-ecb0f38041e0
0
public Map<String, Object> getContext() { return this.getReferRequestWrapper().getContext(); }
b6355714-93d1-4897-ad47-f72ee8029413
7
public void sheduleProcess(MessegeAttributes ms) { if (ms.getStatus() == 1) {//execution Finished if (!readySusQue.isEmpty()) {//& Suspend queue is not empty so put to the ready queue addToreadyBysus(); } else if (!blockQue.isEmpty()) {//if ready sus q...
0273104b-a349-4096-be89-38a609f49ac7
4
@Override public <T> void addObject(T object) { Session session = null; try{ session = sessionFactory.getCurrentSession(); session.beginTransaction(); session.save(object); session.getTransaction().commit(); ...
6eee12aa-f9b9-49d0-8f16-ab1fdc740b37
3
private boolean verifySession(String username, String ssid, String status, Long id) { boolean res = sessionCaptor.getValue().getStatus().equals(status) && sessionCaptor.getValue().getName().equals(username) && sessionCaptor.getValue().getSsid().equals(ssid); if (id != nul...
b0deb539-37c0-403a-ae2a-25a588cd06b0
1
@SuppressWarnings("deprecation") public void testConstructor_RP_RP3() throws Throwable { YearMonthDay dt1 = null; YearMonthDay dt2 = new YearMonthDay(2005, 7, 17); try { new Period(dt1, dt2); fail(); } catch (IllegalArgumentException ex) {} }
e326ed0b-4077-459d-ab12-bb0e0d96a3f3
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractAvaObject other = (AbstractAvaObject) obj; if (id != other.id) return false; if (position == null) { if (other.position !=...
86c70c80-367d-45e2-aa8a-7695fb5a2153
7
private void insertInternal(Song pSong, AudioDevice pAudioDevice) throws MusicPlayerException { //FIXME: move the opening and stuff into start. if ( this.mStreamPlayerRunnable != null ) { if ( !this.mStreamPlayerRunnable.isStopped() ) { throw new IllegalStateException( "You can only insert Songs while the Pl...
faafd6a5-ca0e-462f-9028-d3f4f6b38f5a
5
private static java.awt.Rectangle calculateBounds(final List<Integer[]> lines) { int xLeft = Integer.MAX_VALUE; int xRight = Integer.MIN_VALUE; int yTop = Integer.MAX_VALUE; int yBot = Integer.MIN_VALUE; for (Integer[] line : lines) { if (line[0] < yTop) ...
79c7f363-1d59-492c-a54d-3dfdd4b249d2
5
public static void load(GameContainer gc, StateBasedGame sbg, Player player) throws SlickException { HashMap<String, Map> maps = new HashMap<String, Map>(); // Find and load maps File[] files = new File("res/maps/").listFiles(); for (File file : files) { if (file.isFile() && file.getName().endsWith("tmx")) ...
8485ed93-749a-4ce6-bac6-32f509805171
2
public void discard(int amount) { if(bestVariation!=null && bestVariation.getTotalOverlaps()<baseGenome.getTotalOverlaps()){ // Reverting baseGenome = bestVariation; } baseGenome.discard(amount); this.bestVariation = baseGenome.clone(); }
3bd3d3b3-e0ad-40af-9299-8ae6a8375cb2
6
private int pieceValueAt( int position ) { switch ( pieceTypeAt( position ) ) { case PAWN: return ( 100 ); case KNIGHT: return ( 325 ); case BISHOP: return ( 330 ); case ROOK: return ( 500 ); case QUEEN: return ( 900 ); case KING: return ( 20000 ); } return ( 0 );...
d11ec2da-99dc-4084-bb86-e63c41bf5e1c
8
@Override public Object read(JsonReader in) throws IOException { JsonToken token = in.peek(); switch (token) { case BEGIN_ARRAY: List<Object> list = new ArrayList<Object>(); in.beginArray(); while (in.hasNext()) { list.add(read(in)); } in.endArray(); return list; ...
af812c00-4cfa-4111-b26d-2a87f2ed6a48
2
private void render() { BufferStrategy bs = getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.setColor(Color.BLACK); g.fillRect(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); player.renderHu...
e1a1de0d-aa36-485f-b035-c862f317f1a4
4
public Connection leaseConn() throws SQLException { lock.lock(); try { if (!idleConnections.isEmpty()) { Connection conn = idleConnections.firstElement(); idleConnections.removeElementAt(0); if (conn.isValid(1)) { busyConnections.add(conn); return conn; } else { conn.close(); ...
fded3028-a7f1-4fd8-893f-56b862f22f63
8
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) { List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size()); Tag tag; Tag customTag = classTags.get(javaBean.getClass()); tag = customTag != null ? customTag : new Tag(javaBean.getClass()); ...
35a81c23-2ac4-40ac-8af2-e9d7e198490c
7
public static double acos(double x) { if (x != x) { return Double.NaN; } if (x > 1.0 || x < -1.0) { return Double.NaN; } if (x == -1.0) { return Math.PI; } if (x == 1.0) { return 0.0; } if (x == 0) { return Math.PI / 2.0; } /* Compute acos(x) = atan(sqrt(1-x*x)/x) */ /* Spli...
c740d3e5-4b73-41a5-af33-de87e32886f9
1
public int randomSign() { int sign = 1; if(new Random().nextBoolean()) sign = -1; return sign; }
dd9fb858-f026-4b5a-a53d-20463a61243c
3
public void setName(String name) { if (name == null || this.name == null || !this.name.equals(name)) { this.name = name; this.informPairsOfNameChange(); } }
8aa50351-4b43-4bfc-98ca-3ceabb705fbb
9
private static void loadArguments(String[] args) { for (int a = 0; a < args.length; a++) { if (args[a].startsWith("-")) { if (args[a].equals(LAF_SWITCH)) { if (a < args.length-1) { a++; lookAndFeelClass = args[a]; } } else if (args[a].equals(JG_LAF_SWITCH)) { lookAndFeelClass = S...
91524bf0-ef7a-4b13-b401-619aa8bfc3ef
7
private boolean r_Step_5a() { int v_1; int v_2; // (, line 100 // [, line 101 ket = cursor; // literal, line 101 if (!(eq_s_b(1, "e"))) { return false; ...
af901ae3-c70c-40d3-b63e-6b53757fc81f
3
private void leaveRoom(ServerClient activeclient) { Room leaving = new Room("null"); for (Room r : rooms) { if (r.getClientsInRoom().contains(activeclient)) { leaving = r; } } for (Room r : rooms) { r.roomBroadcast(activeclient, new Msg("moved|"+leaving.getName()+"|null", activeclient.getNi...
21cc90dc-c325-4a14-ab56-b1aecd2ac2ac
4
private boolean cellIsValid(OpenCellIdCell cell, int maxMeasurements, int minMeasurements) { HashSet<Integer> signalValues = new HashSet<Integer>(); for(Measurement m : cell.getMeasurements()) { signalValues.add(m.getSignalStrength()); } if(signalValues.size() <= 3) return false; if(cell.getMeasur...
4c6fd70e-4aaa-43fa-8900-9ddf03b3aa09
6
private String getVisibleText(String text) { if (metrics.stringWidth(text) < width - 8) { return text; } else { String toReturn = ""; for (char ch : text.toCharArray()) { if (metrics.stringWidth(toReturn + ch) < width - (14)) { ...