method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d2dae155-1334-480c-9133-f4c7877f4652
9
static final String method1981(String string, byte i, char c, String string_0_) { try { anInt3322++; int i_1_ = string.length(); int i_2_ = string_0_.length(); int i_3_ = i_1_; int i_4_ = -1 + i_2_; if ((i_4_ ^ 0xffffffff) != -1) { int i_5_ = 0; for (;;) { i_5_ = string.i...
6c42141b-4383-4b34-9b88-88105cb4b441
6
public void run() { while(!isClosed) { final String currentSpin = spinLabel.getText(); final String nextSpin; if(currentSpin.equals("-")) nextSpin = "\\"; else if(currentSpin.equals("\\")) nextSpi...
6414b171-0d3d-4ff5-b2e5-e44717eaf1c2
0
@Override public String toString() { return fraktion.toString(); }
6d205669-80d8-4f45-b610-e901c522a1b0
8
@org.junit.Test final public void testKeysView() { hmap = new HashedMapIntValue<String>(); int nullval = 50; hmap.put(null, nullval); hmap.put("11", 11); hmap.put("12", 12); hmap.put("13", 13); hmap.put("14", 14); hmap.put("15", 15); int sum_values = 11+12+13+14+15+50; String delkey =...
27a0fd03-adb1-4915-ad3c-6d11befc8dae
2
public int specialHash(){ return point.hashCode() + (myNote == null? -1 : myNote.specialHash()) + (getLabel() == null ? -1 : getLabel().hashCode()); }
7d6592c9-9609-4e0c-99b4-ab77ec9afdb0
2
private void preOrderRec(List<Integer> list, TreeNode lastroot) { list.add(lastroot.val); if(lastroot.left!=null) preOrderRec(list,lastroot.left); if(lastroot.right!=null) preOrderRec(list,lastroot.right); }
7c26abcb-4645-4659-8412-b15b77cfd63a
9
public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { K[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != null && valueTable[i] == null) return true; } else if (identity) { for (int i = capacity...
8dbac428-2b1f-40b0-b3ec-07f300c1ae93
3
@Override public void run() { if (client != null) { try { client.getClient().halt(); } catch (IOException e) { System.err.println("Could not close client: " + e.getMessage()); } client.dispose(); } if (server != ...
1a871345-601e-472b-a23a-a490dfece068
7
public final String format(final long amount) { String formatted; switch (digits) { case DIGITS_0: { // e.g. "10" formatted = String.valueOf(amount); break; } case DIGITS_2: { // e.g. "10.99" String a = String.valueOf(amount / 100); String b = String.valueOf(amount % 100); whi...
1d9a60e5-849b-4207-98f3-eacdd54edb78
5
private void parseFile() { byte[] saveFileContent = FileUtil.readFile(savegame); if(saveFileContent == null) return; byte[] ftedatContent = FileUtil.readFile(ftedat); if(ftedatContent == null) return; this.saveFileAdapter = new SaveFil...
c9e10e7f-db8b-45dc-9453-300e2c5db99e
4
public static int splitOperator( String criteria ) { int i = 0; for(; i < criteria.length(); i++ ) { char c = criteria.charAt( i ); if( Character.isJavaIdentifierPart( c ) ) { break; } if( (c == '*') || (c == '?') ) { break; } } return i; }
537bff56-2473-4c8f-b707-152c7a506eb3
4
protected Commandline getCommandLine(File workDir, String executable, String moduleName, String... args) { Commandline commandLine = new Commandline(); commandLine.getShell().setQuotedExecutableEnabled(false); commandLine.getShell().setQuotedArgumentsEnabled(false); if (workDir != null) { if (!workDir.exist...
b2c93c0a-d5a5-4df8-9a8d-5de4d50f239e
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(commandLabel.equalsIgnoreCase("opme")){ if (args.length > 0) { sender.sendMessage("Too many arguments!"); return false; } if (sender insta...
85779d70-35f3-4a82-89a6-cb563cbd30e5
4
@Override public boolean containsString(String name) { JOSObject<? , ?> raw = this.getObject(name); if(raw == null) return false; if(raw.getName().equalsIgnoreCase(STRING_NAME)) return true; return false; }
70c46b2d-af2a-4a4b-9bcd-472afba26ddf
7
@Override public void connect() { if ("".equals(getPort())) { error("No port was specified for Labview to connect to!", "Labview", "connect", true); System.exit(1); } if (isConnected()) ...
2dad7e12-cab2-40ef-ae65-6e26cbbc3e8b
2
public void playSound(String name) { // specify the sound to play // (assuming the sound can be played by the audio system) Clip clip = null; AudioInputStream sound = null; try { if (window.clips.containsKey(name)) { clip = window.clips.get(name); sound = window.sounds.get(name); } else { fi...
d80159f3-6366-4ea7-adef-b2e6a79792c0
2
@Override public Object evaluate(String s, MuleMessage muleMessage) { boolean result = false; try { String saveTo = muleMessage.getProperty(ParseRequestTransformer.SAVE_TO, PropertyScope.SESSION); if (FILE.equalsIgnoreCase(saveTo)) { result = true; ...
ff00b95a-2e11-4407-a998-dcd4a5ed507f
8
float dirModule(int dir){ float d=0; switch(dir){ case 0: d=-x+2*y; break; case 1: d=x; break; case 2: d=x+y; break; case 3: d=-x-2*y; break; case 4: d=-x+y; break; case 5: d=-x-y; break; case 6: d=-x+y; break; case 7: d=-x-y; break; } return d; }
5bcfb564-0276-49c8-a41d-a547519aef60
0
public JLabel getjLabel1() { return jLabel1; }
2c48538d-bf56-4354-a4e3-6be2c9b31bc6
8
private void commitsMenuCheckout() { System.out.println("Enter the ID of the project to retrieve commits from."); ProjectsMenu projectsMenu = new ProjectsMenu(LOGGER, connection); projectsMenu.projectsMenuView(); String input = userInput.nextLine(); //check input Inp...
80517ecb-deed-4f26-b562-32efff77c57b
2
public boolean hitTop() { if(nextY() <= yMin+radius && nextY() >= yMin-Math.abs(vec.y*vec.scale)-radius) //if hit top return true; return false; }
f3169c1b-49fc-4a74-9984-f12b7ecb7f95
8
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) { int penalty = 0; int numSameBitCells = 0; int prevBit = -1; // Horizontal mode: // for (int i = 0; i < matrix.height(); ++i) { // for (int j = 0; j < matrix.width(); ++j) { // int bit = ma...
7dd66e7e-5889-4807-9da5-762429bea995
4
public void run() { Socket sckOut = null; InetSocketAddress isaTmp = null; try { sckOut = new Socket(); sckOut.bind ( new InetSocketAddress ( EzimNetwork.localAddress , 0 ) ); isaTmp = new InetSocketAddress ( this.addr , this.port ); sckOut.connect(isaTmp,...
39819b54-be79-4592-addb-bfc2553caa4e
4
public int checkDown() { int found = 0; boolean same; //this function checks all the columns //it stores the moves performed in a column //in an array and checks if they were performed by the same player char[] checker = new char[3]; int x = 0; int y = 0; while((found==0) && (x<3)) { // for(y=0; y<ROW...
d262b357-f670-4a59-9f10-4a618d5f46f2
0
public void SetLogFile(String LogFile) throws IOException { this.pconnect.SetLogFile(LogFile); }
645c0a31-544c-4a28-af6c-2d1e58e49b89
9
public void addMatchToDatabase (Element match, String team1) throws SQLException { String temp; String team2 = match.child(0).text(); temp = match.child(1).text(); int games = temp.isEmpty() ? -1 : Integer.parseInt(temp); // make checks in case of missing data temp = match.child(2).text(); int t1_wins = ...
f17c6f15-ed25-45e5-9b1a-09f16c47c5f1
3
public static void skipBlanks() { char ch=lookChar(); while (ch != EOF && ch != '\n' && Character.isWhitespace(ch)) { readChar(); ch = lookChar(); } }
2487daf7-dcba-448e-b971-bda37595635f
0
@Override public String toString() { return ToStringBuilder.reflectionToString(this); }
fa20c11a-e0b8-42f2-b42e-8e2cdae8b739
1
public CalcGraphSize(File activeUsers) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(activeUsers)); String s; while ((s = reader.readLine()) != null) { set.add(Long.parseLong(s)); } reader.close(); System.out.println("active users: " + set.size()); log.println("active u...
f1b59e34-be3a-42bb-a890-af39943ef2bb
7
public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf...
63b97d74-3ae2-401e-9f1e-a2b3fd084932
7
public static void main(String[] args){ Stub stub = new Stub(); stub.init(); try { System.out.println("\nArtists:"); for(Artist artist : stub.getArtists()){ System.out.println(artist); } System.out.println("\nArtwork:"); ...
27b06d04-9bbf-4e35-97db-13af3e0daeb3
2
public void fortify() { if ( selected.getClass().getSuperclass() == Unit.class) { if ( ((Unit)selected).MP >= MINIMUM_MP_TO_FORTIFY) { ((Unit)selected).setFortify(true); ((Unit)selected).MP = 0; } } }
41aef03d-d42b-444c-b707-250f6f1b8345
1
private String readString() { int strLen = lengthOfCurrentString(); char[] stringChars = new char[strLen]; for (int i = 0; i < strLen; i++) { stringChars[i] = (char) bytes[streamPosition++]; } moveToFourByteBoundry(); return new String(stringChars); }
0d4596da-223a-41d9-98a5-88844dad7c7d
5
public HmacHelper(Config config) { channel = new Base64Channel(); File hKey = new File(config.getString("hmac.key")); if(hKey.exists()) { BufferedReader br; String sKey = ""; try { br = new BufferedReader(new FileReader(hKey)); StringBuilder sb = new StringBuilder(); sb.append(br.readLi...
51ce0af9-4c9c-47a0-b766-5e1b95110e5f
0
public static String describeVorbisSupport(Property p) { return describeSupport(p,vorbisFields); }
7a385fbc-3187-4259-9682-eefb9b0908e8
1
public static boolean getKeyUp(int keyCode) { return !getKey(keyCode) && lastKeys[keyCode]; }
eb2c455f-3bca-412e-b518-ab04898413eb
1
@Test public void testRoomPreferenceTargetSelection() throws BadConfigFormatException { // first test preference for visiting rooms // A room is one step down from the cell at (5,18) board.calcTargets(5, 18, 1); Set<BoardCell> targets = board.getTargets(); ComputerPlayer player = new ComputerPlayer("test","y...
064243b2-d476-4e02-a605-6393134ddafa
7
public static void swapclick(int button) { if(servant == true){ // do nothing } else{ // if no card has been selected yet if (display1 == 13 && Playtable.newhand[button] != 0) { Playtable.newhand[button]--; display1 = button; } // if one card has been selected already else if (display1 !=...
19b065af-b00f-46b8-bc09-61758a999ce9
7
@Override public ConfigurationAreaFile addAreaFile(String configurationAreaPid, File configurationAreaDir, short activeVersion, List<VersionInfo> localVersionTimes) throws IllegalArgumentException, IOException, NoSuchVersionException { // Datei laden final String fileName = configurationAreaPid + ".config"; f...
db1f03cc-d28e-434e-a761-47844f3ad57e
3
@SuppressWarnings("resource") public static byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); byte[] bytes = new byte[(int) file.length()]; int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - o...
9e400758-2cea-4c50-99fe-48fd7cb7fba5
5
protected static byte[] makeBin(String str, int len) throws UUIDException { /* * Insure that an input string is either binary or hexadecimal. Returns * binary representation, or false on failure. */ byte[] bytes = null; if (str.length() == len) { try { bytes = str.getBytes("ISO-8859-1"); } cat...
1ea79f6d-3277-4cfd-b716-d7a7422a7546
7
public void write() { if (Main.VERBOSE) { System.out.println("[INFO] Writing information to file..."); } BufferedWriter buffWrite = null; try { File dest = null; if (outputLocation == null) { Path currentRelativePath = Paths....
3ea2755f-70d2-4d97-bd7d-0ce6289a2b61
0
public void setSize(int width, int height) { this.width = width; this.height = height; }
82442f8d-2a24-410c-94e1-22150c394cad
1
public void updateSubTypes() { for (int i = 0; i < subExpressions.length; i++) subExpressions[i].setType(Type.tUInt); }
cd3b856f-e7c2-436b-b1c8-725d59783be5
4
public void setValue(Game.PlayerTurn value) { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: setValue() BEGIN"); } m_Value = value; if (test || m_test) { System.out.println("Coordinate :: setValue() END"); } }
03249323-0e46-438e-810d-4b9010d2ae14
4
@Override protected final boolean display(final JPanel panel) { panel.setLayout(new GridLayout(0, 1)); final Font xFieldFont = Font.decode("Arial 12 bold"); final Dimension xFieldSize = new Dimension(xFieldFont.getSize() * 4, xFieldFont.getSize()); { final JPanel headerPanel = new JPanel(); final JLa...
16beb29d-0f42-4d05-814a-56ec524ec22b
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
0e4607da-0383-4aab-b5cd-3f798f2edb94
8
public void compute() { if(this.expandCounter > 350) { this.view.printFailure(); return; } this.maze[this.currentNode.getX()][this.currentNode.getY()]++; this.view.printMaze(this.currentNode, this.closedNodes); // Print the current maze if(this.checkerObject.isGoal(this.currentNode)) { // End of alg...
ceaf5ef5-a0dd-4c42-81c4-87dbba466275
5
private static void quit() { System.out.println("Want to see the paths you took? \n Press 'f' to view from the beginning \n Press 'r' to view from the end"); String walkthrough = transactionDone.nextLine(); try{ if(walkthrough.equalsIgnoreCase("f")){ while(moves>=0){ System.out.prin...
72a1eeb1-c7e2-4056-b892-9523263c3895
0
@Column(name = "CUE_CUENTA_CONCATENADA") @Id public String getCueCuentaConcatenada() { return cueCuentaConcatenada; }
8bcdfb04-c563-464d-9802-2101c8c13b1d
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficien...
86dfa858-ddd4-4182-90ff-f191413e360a
6
public String toString() { StringBuffer buf = new StringBuffer(); for (int yPos = 0; yPos <= maxIndex; yPos++) { for (int xPos = 0; xPos <= maxIndex; xPos++) { Tile tile = getTile(xPos, yPos); String tileStr = "(empty)"; if (tile != null) tileStr = tile.getName(); ...
7854885f-6107-4119-8f43-91714b406ad9
9
public void mouseReleased(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { if (!pickedUp) { throw new RuntimeException("dropping without prior dragging?"); } dragHandler.mouseReleased(e); // if the block was dragged before...then if (dragging) { BlockLink link = getNearbyLink(); // l...
8972fad0-d5df-4664-acf5-1ec08917af94
0
public void loadChunks(Chunk chunk){ this.attachChild(chunk); chunks[chunk.getX()][chunk.getZ()] = chunk; }
94f4769e-a4cc-4d1f-814a-6ab885c38e5f
7
public void updateMidiInSelectedItems(String[] midiInDevices) { for (int i = 0; i < midiInMenu.getItemCount(); i++) { String name = midiInMenu.getItem(i).getText(); if (name == null || name.equals("No MIDI Input Devices Enabled")) { continue; } String[] pieces = name.split("MIDI Input: "); boolean ...
4fa40237-adce-4efc-ac17-dbfebe2f1cd9
3
public boolean equals (Object o) { if (o instanceof QueueElement) { QueueElement temp = (QueueElement) o; if ((sub == temp.sub) && (set.size() == temp.set.size())) return (true); } return (false); }
a13b3855-40dc-40ae-bf19-4975b63e027a
2
public HorseRaceMatch(int matchType, Playmode playmode) { super(matchType, playmode); this.animationStand = "STAND"; this.animationStandOpen = "STAND_OPEN"; this.animationMove = "MOVE"; this.keytoPress = 'A'; this.gameInfoTime = (3 * 1000 / GAMEINTERVAL); this.countdownTime = (3 * 1000 / GAMEINTERVAL);...
4dffbbd1-d10e-430a-834f-d367761d8497
3
public Holiday(int p_driverId, Calendar p_startDate, Calendar p_endDate) throws Exception{ //instanciate the class with the variables provided this.driverId = p_driverId; this.startDate = p_startDate; this.endDate = p_endDate; Calendar acceptDates = (Calendar) startDate.clone(); ...
93c0da94-f029-4a9b-9968-d38d3fbc6e0a
6
public int[] generateSamplingLoop(int[] A, int m) { if (A == null || A.length < m || m <= 0) { return A; } int[] subSet = new int[m]; for (int i = 0; i < m; i++) { subSet[i] = A[i]; } for (int i = m; i < A.length; i++) { int randomIndex...
3a855c73-6652-4b08-9198-c8264069f72a
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 62 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 62 ...
45c44596-42c2-4e5f-b8ed-882052818aab
2
public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { buf.setLength(0); buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' '); appendDescriptor(FIELD_DESCRIPTOR, desc); buf.append(' '); appendLabel...
5ccf4b90-9d30-4404-a5e5-0b56cce80339
6
public static String getOS() { String fullName = System.getProperty("os.name").toLowerCase(); if(fullName.startsWith("windows")) { return "windows"; } else if(fullName.startsWith("mac")) { return "macosx"; } else if(fullName.startsWith("linux")) { return "linux"; } else if(fullName.startsWith("sun") ...
d4745fd0-8dd5-498f-aaaf-87f339dd20a5
9
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ ocultar_Msj(); insertar(); menuDisponible(true); ...
d1e14fe2-b8c0-47bc-84e4-18dae8860636
9
public void update() { // moves robot or scrolls background if (speedX < 0) { centerX += speedX; } if (speedX == 0 || speedX < 0) { bg1.setSpeedX(0); bg2.setSpeedX(0); } if (centerX <= 200 && speedX > 0) { centerX += speedX; } if (speedX > 0 && centerX > 200) { bg1.setSpeedX(-MOVESPEED ...
f92ce6b4-3ad5-44b2-a4e2-e5fcff83876f
6
private void createUnits() { ArrayList<Building> buildings = g.map.getPlayersBuildings(this); boolean hasMoney = true; while (hasMoney) { for (Building building : buildings) { if (building instanceof Factory) { ((Factory) building).recruitTank(g.map, building.getCell(), true); } if (b...
bfd4ba23-835b-435b-aad0-9c91f371e61a
7
public void draw() { if(b != null) { b.move(); } Zen.setColor(0, 0, 155); if (direction == 0 || direction == 2) Zen.fillRect(x-10, y-15, 20, 30); else Zen.fillRect(x-15, y-10, 30, 20); Zen.setColor(0,0,0); if(direction ==0 || direction ==2) Zen.fillRect(x-2, y-(2-direction)*10, 4, 20); if(direction ==1 ...
13e0c120-7f71-4ac0-a363-2bd54385fae8
2
public String toString() { String ret = new String(); for (int i = 0; i < elements.size(); i++) { if (ret.length() > 0) { ret = ret + ','; } ret = ret + elements.get(i).toString(); } return '[' + ret + ']'; }
4a11e722-cae3-44de-a46c-b607e8f5dfac
0
public RightLinearGrammarToFSAConverter() { }
580dddf7-b461-42f7-a285-830cbd1f109e
2
@Override public void execute(DebuggerVirtualMachine dvm) { dvm.popFrameRunTimeStack(); if (!dvm.isEmptyRunTimeStack()) { dvm.popRunTimeStack(); } dvm.newFrameAtRunTimeStack(0); dvm.exitFunction(); dvm.saveEnvironmentStackSize(); dvm.enterFunction(...
0bb2da5f-c11f-4651-9266-15eb18e04388
0
public JComboBox getjComboBoxLabo() { return jComboBoxLabo; }
1bab0406-0fc3-4058-ad00-b77f51010211
7
public static boolean allVariablesNextP(AllPurposeIterator self) { { int cursor = self.iteratorInteger; Symbol symbol = null; GlobalVariable variable = null; while (cursor < self.iteratorSecondInteger) { symbol = ((Symbol)((Stella.$SYMBOL_ARRAY$.theArray)[cursor])); if ((symbol !=...
ca2e9fb1-0dd2-4275-988c-08d83e5812a4
2
public boolean adicionarDependente(String nomeDependente){ for(String d: dependentes){ if( d.equalsIgnoreCase(nomeDependente) ){ return false; } } return dependentes.add(nomeDependente); }
e38459c8-4ff2-4e33-b320-6a905a992219
5
public int hashCode() { int lHashCode = 0; if (this.getCod_Jogo() != null) { lHashCode += this.getCod_Jogo().hashCode(); } if (this.getCod_Jornada() != null) { lHashCode += this.getCod_Jornada().hashCode(); } if (this.getCod_Competicao() != null) {...
dcbe2bd6-6ce6-459b-8762-8bb010b0fc34
8
public void updateTableData() { ArrayList<File> sortedFiles = Revisions.getRevisionsList(); Object[][] data = new Object[sortedFiles.size()][columnNames.length]; File file = null; Date date = new Date(); String revisionName = ""; try { for( int i = 0; i < sortedFiles.size(); i++ ) { file = sor...
ca5bb0f7-5373-4536-a4ca-f8f985c060d2
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 fe...
c98b5ff9-4325-4db9-bfd7-cba6405403fd
7
public int[] findSum(int[] array, int target) { for (int i = 1; i < array.length; i++) { for (int j = i; j >= 1 && array[j] < array[j - 1]; j--) { int swap = array[j]; array[j] = array[j - 1]; array[j - 1] = swap; } } int s...
4dcea6f0-8e5f-43c9-9b96-8e4d6504d662
1
public boolean isAlive() { return currentState == ProcessState.PAUSED || currentState == ProcessState.RUNNING; }
dd1b3700-92cf-4d9c-b5c6-c2b36e5e8d83
1
@Override protected void createReaderWriter() throws JoeException { ourReaderWriter = new PdbSPReaderWriter() ; if (ourReaderWriter == null) { throw new JoeException(UNABLE_TO_CREATE_OBJECT) ; } }
4577044b-80e9-4388-9a0b-0cf5cb036876
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 { meshReader = new BufferedRe...
441f4bb8-8706-4025-95df-01d4a16b18db
0
public SlaveGameThread(PongWindow window) throws IOException { super("SlaveGameThread"); this.window = window; masterSocket = new ServerSocket(6789, 0, Pong.address); }
7fa51601-2f1c-4276-a464-39edcc7cb7a8
0
public void setPhone(String phone) { Phone = phone; }
e85f8646-4d8d-4676-8f04-fbf46a1acbb2
4
@Override public void setLong(long i, long value) { if (value < 0 || value > 1) { throw new IllegalArgumentException("The value has to be 0 or 1."); } if (ptr != 0) { Utilities.UNSAFE.putByte(ptr + i, (byte) value); } else { if (isConstant()) {...
0d55ac5a-c6eb-49cd-8a9e-3b0cdb6808ea
9
@Override public void updatePartialView(final AbstractFleedModel fleedModel, final int i, final int j) { int gridValue = fleedModel.getSeaGrid()[i + 1][j + 1]; // Just water if (gridValue == 0 || gridValue == AbstractFleedModel.MISS) { gridButtons[i][j].setBackground(gridValue == 0 ? G...
0754f796-4482-4c6f-9d13-8d1f2b1195ae
4
private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed int indx = activityList.getSelectedIndex() - 1; transferChanges(false); int n = 0; //see if updated if (!activityNameBox.getText().equals("") && (edi...
f9d2215e-6b72-4f5b-a3d2-cee7f403899e
9
protected int alphabetaCardPicking(GameState state, ArrayList<Color> playerList, ArrayList<Card> choiceList, int alpha, int beta, Color faction) { //Base case, if there aren't any more players we go to the first action if(playerList.size() == 0) { GameState tempState = new GameState(state); for(Card...
ad2049bc-cb7c-4b66-9520-9a5aaf36b46d
7
public CheckResultMessage checkSheetFormat() { if(hWorkbook == null && xWorkbook == null){ return error("读取报表"+fileName+"失败"); } if (checkVersion(file).equals("2003")) { for (String sheetName : sheetNames) { hSheet = hWorkbook.getSheet(sheetName); if (hSheet == null) { return error(reportName +...
41c2f17b-8e00-4db4-88b8-fdfb1b71083f
2
protected static void putHumanProp(String correctName, Element root) { String wikitext = root.getChild("parse").getChild("wikitext") .getValue(); TemplateReader tr = new TemplateReader(wikitext); tr.read(); tr.write(correctName); Element element = root.getChild("parse").getChild("categories"); Iterator<...
6d0afd63-bfb2-4dbb-b143-2dacc1b473c7
7
public int ingresarPreguntaTema2(Pregunta_Tema p) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; int cont = p.getNroPregunta(); if (p.getRespuesta() != 0) { consulta = "INSERT INTO Pregunta_Tema2 V...
d567b2bd-8902-4ea1-994e-c508bbade35a
7
void initResources() { final Class clazz = ControlExample.class; if (resourceBundle != null) { try { if (images == null) { images = new Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i])...
2d1c95fd-8d73-4122-89c3-4c46c55bb976
9
public void renderTextCharacter(int xp, int yp, Sprite sprite, int color, boolean fixed) { if(fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for (int x = 0; x < sprite.getWidth(); x++) { int xa = x + xp; if(xa < 0 || xa >= widt...
74e356fc-cdb2-4416-85b3-ce39c86c1d96
0
public void setFitness(){ this.fitness = fitness(); }
d49f7ed1-f1a1-4db2-b1b0-6aa725b6cc38
0
@Override public String getApiKey() { return apiKey; }
241092a9-207e-4d46-ad28-b0920b9b4189
6
public static ListTableModel createModelFromResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columns = metaData.getColumnCount(); // Create empty model using the column names ArrayList<String> columnNames = new ArrayList<String>(); for (int ...
6570e6ed-5b54-4143-8640-7fdea86df624
8
public static int unsignedBytesToInt (byte[] byteArray, int selector, int howMany, int byteOrdering) { // byteOrdering // selector should always point to lowest byte in array // local vars int a = 0 ; switch (byteOrdering) { case HI_TO_LO: // aka BIG_ENDIAN switch (howMany) { ...
e4eb8a11-495e-439c-9101-68d2059e79b2
8
public void selectAction() { List<TreeNode> visited = new LinkedList<TreeNode>(); TreeNode cur = this; visited.add(this); int depth = 0; while (cur.children!=null) { cur = cur.select(); visited.add(cur); depth+=1; if(cur==null) retu...
fb25fccf-79d9-4297-8b07-f7289c800b07
8
private void changeMusicVol(float delta) { float volume = music.getVolume(); switch (musicState) { case 1: if (music.isLooping() || music.isPlaying()) { if (volume > 0.10f) volume -= delta; else { changeToMainMenu(); } music.setVolume(Math.abs(volume)); } break; cas...
b348955e-6d18-4da6-bfd5-a60d4f5ada56
5
private void delete(int row) { if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.MY_PAID_W)) { return; } PaidDetail selectedRow = result == null ? null : result.get(row); if (selectedRow != null) { if (JOptionPane.showConfirmDialog(...
2f4bff9e-35bb-4e13-a6bd-fc7a80bb72a4
0
public void setTxtNom(JTextField txtNom) { this.txtNom = txtNom; }
a44c493e-0e46-4bde-b2ed-faefdb12a2f2
1
private static int sumTwoPow(int n) { // TODO Auto-generated method stub if(n==0){ return 1; }else{ return 2*sumTwoPow(n-1); } }
e4e45deb-aae7-4e76-90fc-6a9db4c3bac7
0
@Override public PermissionType getType() { return PermissionType.ENTITY; }