method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
03933c59-3ca3-4a31-aefb-5e0a14687a1a
4
@Override public void keyPressed(KeyEvent e) { if(context == 0) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { context = 1; } } else if(context == 1) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { context = 0; } }/* Movement testing if (e.getKeyCode() == KeyEven...
ae57e74e-d6ba-4f76-8069-8b8a4ab7361a
6
@Test public void test() throws IOException, ClassNotFoundException { PrintStream ps = ReaderFactory.initTestReader(); // Netzwerk initialisieren final PacketQueue pq = new PacketQueue(); ConnectionListener cl = null; cl = new ConnectionListener(Settings.getPortNumber(), "",...
604667b0-7cc9-41fe-8a21-d9f7e068e3f9
7
public ChessFrame(MouseListener c) { super(); this.controller = c; Dimension boardSize = new Dimension(sizex, sizey); JPanel sideBar = new JPanel(); sideBar.setPreferredSize(new Dimension(150, 800)); displayJoueur = new JLabel("Aux blancs de jouer"); displayTim...
1dbd1554-ccc2-4fc9-920c-bba4a63edd76
0
public Queue GetDistributionQueue() { return q; }
c1cb85cb-b0c5-417f-bce0-7e0edcd6c384
4
private static final boolean svreconcile(long[] svA, long[] svB, Vector<long[]> deltas) { if (svA.length == 0 && svB.length == 0) { deltas.add(new long[0]); deltas.add(new long[0]); return true; } long[] diffA = svdiff(svA,svB); if(diffA.length > svt...
0241a2f8-8aa5-48fe-a5e1-ba84cfab709f
0
public void setAcceleratorEnabled(boolean enabled) { _accelerator.setEnabled(enabled); }
aeb4c3c8-f26d-472a-acd1-c0d3a8f669c8
9
boolean[] getQuadruplets(){ // Find quadruplets for quad match algorithm Integer[] array1 = new Integer[getFirstPlayersW()]; // Get bitwise >> 2 placement numbers for (Entry<Bracket, Integer> mapEntry : BrackEm.winPanel.hashList.get(0).entrySet()) // Get all first round (0) brackets { Bracket key = mapEntry...
077daeaf-df6c-4ad4-85b7-c7338532fd35
1
private void assignmentStatement() { if (accept(NonTerminal.ASSIGNMENT_STATEMENT)) { designator(); expect(Token.Kind.ASSIGN); expression0(); expect(Token.Kind.SEMICOLON); } }
f5552828-f01e-494f-95f7-40cc39ea31c2
0
public void doCancel() { FalseStartLabel.getInstance().clear(); answerSide = null; }
3dca6aaf-befb-490f-835b-4e15afeabaad
0
public Language getLanguage() { return language; }
45630c02-1f92-4bf9-a79f-13be4991b612
6
public String getNextRDV(String msg) { String answer = ""; boolean next = false; int nearestDate = 0; for (int i = 0; i < listCal.size(); i++) { if (listCal.get(i).getDebut().compareTo(Calendar.getInstance()) > 0) { nearestDate = i; next = tru...
92d8635d-9487-4ebf-b981-be84f78a54c0
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...
e6efb0a9-b81e-4497-ba18-798f23a75a42
3
public void cleanUp() { if (screenshots == null || screenshots.size() == 0) return; for(ScreenShot screen : screenshots) { screen.deleteScreenshot(); } }
e902046a-5b70-42c9-bea5-a64162788a56
0
public EncryptionMethodType getEncryptionMethod() { return encryptionMethod; }
bb7ec17e-46a7-4856-a44c-5a8dc6bf5411
8
public static String lcs(String x, String y) { int M = x.length(); int N = y.length(); StringBuffer lcs = new StringBuffer(M>N?M:N); // opt[i][j] = length of LCS of x[i..M] and y[j..N] int[][] opt = new int[M+1][N+1]; // compute length of LCS and all subproblems...
05d792af-f69f-411f-ab6a-aa596cc67ae0
0
@Basic @Column(name = "address_2") public String getAddress2() { return address2; }
56a5680d-b047-46f6-bb0f-183b0d93c623
9
public static Stella_Object evaluateFunctionTerm(Cons tree) { if (!(Stella_Object.isaP(tree.value, Logic.SGT_STELLA_GENERALIZED_SYMBOL))) { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get(); try { ...
6d409023-80ad-4824-97f3-e7fbbef634bd
5
public void coordinator(String projN, String cycle){ ArrayList<String> coor=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/common/coordinator.xml"),"UTF-8"); StringBuffer content=new StringBuffer(); String cycleTag="${coord:days(1)}"; if(cycle.equalsIgnoreCase(...
2c24b6d8-b547-4c0d-89cf-7ba9ef6baa84
4
@Override public String toString() { String res = ""; res += this.inventory.toString(); res += "\n\n"; res += "--- USERS ---\n"; res += "\nManagers\n"; for (User u : this.managers) { res += "\t" + u.toString() + "\n"; } res += "\nStudent...
419fa17f-3b25-4ecf-b4c2-47a40a87479b
7
* @param increment * @return Stella_Object */ public static Stella_Object stella_Increment(Stella_Object place, Cons increment) { { Stella_Object incr = increment.value; if (!(Stella_Object.symbolP(place) || Stella_Object.consP(place))) { if (place == null) { { Object old$...
14958bd1-9961-4bb4-93e7-0ab1e35a39c4
9
protected ArrayList<String> ParseGameArguments(){ String sartemp[] = GlobalVar.minecraftArguments.split(" "); String word = new String(); ArrayList<String> arltemp = new ArrayList<String>(); if(GlobalVar.ExpertSettings){ Utils.LogPrintConsole("Использован сторонний путь до java: "+Globa...
1724f5d8-a769-457e-b560-b6966b828b97
0
private void addEvent(AuditEvent event){ this.events.add(event); }
5114aa90-177f-4a21-84a7-9744cc82db6f
0
private void serveError(Response response, OutputStream body, Status status, TrackerError error) throws IOException { response.setCode(status.getCode()); response.setText(status.getDescription()); logger.warn("Could not process announce request (" + error.getMessage() + ") !"); BEncoder.bencode(error.toB...
5b6c0aaf-d88a-464e-b0ce-4b6580f26456
9
public Map<Integer, Double> getRankedTagList(int userID, int resID) { Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>(); if (this.userMaps != null && userID < this.userMaps.size()) { Map<Integer, Double> userMap = this.userMaps.get(userID); Map<Integer, Double> recMap = this.tagRecencies.g...
027b2128-6d74-44a2-a3a0-935bd4f3165c
7
public void rotarIzquierda() { if (direccion.equals(Direccion.derecha)) { rotar(tipoTrans.enZ, 180); } else if (direccion.equals(Direccion.adelante)) { rotar(tipoTrans.enZ, 90); } else if (direccion.equals(Direccion.atras)) { rotar(tipoTrans.enZ, -90); ...
ea2889ad-a34c-4610-ae78-eee894f80600
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
35e47d75-59fb-463c-9d72-c277257f788e
1
public int hashCode() { int val = Integer.parseInt(value.toString()); // I am from India return val != 0 ? val : value.hashCode(); }
2412421b-89ee-430d-b7d3-ad953677a723
8
public boolean getUserlist() throws Exception{ if(chatting) { Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); String request = "http://"+config.getHost()+":"+config.getPort()+config.getComstring()+ ";jsessionid="+sessionID+"?showhtml=nicklist...
6d24bb80-6233-4a64-a9f4-076f98782d9c
2
private void acao179(Token token) { //Retira aspas valorConstante = token.getLexeme().length() > 2 ? token.getLexeme().substring(1, token.getLexeme().length() - 1) : ""; tipoConstante = valorConstante.length() == 1 ? Tipo.CARACTERE : Tipo.CADEIA; }
c3bec4a4-df28-4519-aeb8-16da54af452a
3
public static String stripFilenameExtension(String path) { if (path == null) { return null; } int extIndex = path.lastIndexOf(EXTENSION_SEPARATOR); if (extIndex == -1) { return path; } int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR); if (folderIndex > extIndex) { return path; } return pa...
100df59a-e19e-42f9-8bce-14eeb764ebb8
5
@Override public void run() { try { String message = input.nextLine(); //IMPORTANT blocking call String[] protocolStrings = message.split("#"); socket.getOutputStream().flush(); Logger.getLogger(MainServer.class.getName()).log(Level.INFO, String.format("Recei...
25780efd-90ad-414f-9307-8c9f775f143c
4
public FutureMeeting getFutureMeeting(int id) { try { FutureMeeting returner = (FutureMeeting) getMeeting(id); if (returner.getDate().getTime().before(theCalendar.getTime())) { throw new IllegalArgumentException( "The meeting corresponding to the ID that you entered has not yet occurred."); } else...
38985cd6-6645-4a11-b406-75ded4c7943c
7
public void Accelerate() { vx+=dx; vy+=dy; x+=vx; y+=vy; y2+=vy; s+=vy; if(vy<0){ vy=0; dy=0; } if(y2>=0){ y=0; y2=-1200; } vx*=0.95; vy*=0.995; if(vx>=5) vx=5; if(vx<=-5) vx=-5; if(vy>=MaxV) vy=MaxV; if(this.x>=RightPoint) FullStop((int)s...
0aa243e5-e941-43f5-80bf-bafdbbcd430b
2
public Field getNextUnattributedClass() { //System.out.println("Group.getNextUnattributedClass() : " + this + " " + this.classes); Iterator<Field> iter = this.classes.keySet().iterator(); Field f; while (iter.hasNext()) { f = iter.next(); if (this.links.getLinks(f).size() == 0) return f...
f062b586-0acd-4e44-9693-5c0743437dbd
0
public char GetDirection() { return this.direction; }
4752c1f6-75ee-4a19-b72e-3e0f1eaba021
2
public void dconst(final double cst) { long bits = Double.doubleToLongBits(cst); if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d mv.visitInsn(Opcodes.DCONST_0 + (int) cst); } else { mv.visitLdcInsn(new Double(cst)); } }
bcb17763-cf63-4c90-861b-f6fbc501611d
9
public void testTime( GroupSet<Integer, Integer> set ) { for( int i = 0; i < 100000; i++ ) { switch( mRand.nextInt( 4 ) ) { case 0: { int c = mRand.nextInt( 10 ); int v = mRand.nextInt( 100 ); set.add( c, v ); ...
dc2a5c42-7528-477f-b922-9a3ab875873f
1
@Override public double getExpectation() throws ExpectationException { if (alpha > 1) { return beta / (alpha - 1); } else { throw new ExpectationException("InverseGamma expectation alpha > 1."); } }
2d543c8a-c655-4191-9c5a-7c722573ed71
3
ScriptSegment consumeBuffer(String pBuffer) throws ExParser { //Sanity check that the buffer starts with the correct sequence if(pBuffer.indexOf(mEscapeDelimiter.mStartSequence) != 0){ //This is an internal error, this method should not have been called if the buffer is not in the correct state ...
c55fef03-1540-4f9b-a32a-dcd324cc3f75
1
private void fillHLLCounter(HLLCounter h, Random r, int n) { for(int i = 0; i < n; i++) { h.put(String.valueOf(r.nextDouble())); } }
27742e6d-6346-42b8-9bf2-53e0b755f863
2
public static boolean put(SocketAddress sa){ synchronized(map){ if(map.containsKey(sa)){ int i = map.get(sa); if(i >= max){ return false; }else{ map.put(sa, i+1); return true; } }else{ map.put(sa, 1); return true; } } }
d94eeabc-68c2-477d-bed7-90c92507cc8c
9
public void calculateNetForce() { forces.clear(); // get current location Point position = sensorManager.getLastLocation(); double heading = sensorManager.getLastHeading(); // calculate heading to target if (position != null && target != null) { System.out.println("position: " + position.toString...
ec6067ca-af9f-48e6-a473-333bb16563bf
0
public static void setBreedingProbability(double newBREEDING_PROBABILITY) { BREEDING_PROBABILITY = newBREEDING_PROBABILITY; }
e8b23ee7-1b88-4971-a33a-fe328bd4d85a
6
private void filter(JSONObject o) throws JSONException { Iterator ji = o.keys(); while (ji.hasNext()) { String key = (String) ji.next(); Object val = o.get(key); if (val.getClass() == JSONObject.class) { if (!firstCall) { index++; Element e = new Element(key); tree.add(index, e); f...
0fa413a3-5e6b-4c71-82c8-11a044fcd5d5
1
public IMachine createVm(IImage image, IMachineDescriptor machineDescriptor, IComputeCenter computeCenter) throws ConnectorException { String vmName = createName(Utils.VM_PREFIX); try { // // Getting appropriate information for creating recompose body // String response = doGet(vAppLink); Document...
a0180548-053d-473b-b995-913c62c24223
6
@Override public void update() { // Check user input and create more balls or turn on/off collision detection // as requested if( this.gameEngine.inputEvent.keyTyped( KeyEvent.VK_1 ) ) this.createBalls( 1 ); else if( this.gameEngine.inputEvent.keyTyped( KeyEvent.VK_2 ) ) ...
8de5f5ae-4164-44cc-9fd1-3459a8c4c878
5
public static Vector<String[]> getQueryData(String tableName, Vector<String> headers) { Vector<String[]> rowsData = new Vector<String[]>(); try { statement = (PreparedStatement) connection .prepareStatement("SELECT * FROM " + tableName); rs = statement.executeQuery(); ResultSetMetaData meta = rs.ge...
f648f4dd-3e05-4f92-a3c5-cfdc110dfa11
5
public static boolean TestMagic(int M,int distance,int time){ if(time <= T){ longdistance=longdistance>distance?longdistance:distance; System.out.println("longdistance= "+longdistance); } if(distance >= S){ mintime=mintime>time?time:mintime; System.out.println("mintime= "+mintime); return true;...
443ceead-1131-48b7-bfda-142eb43ab2f8
0
public BDApplication() { // ArrayList<Metadonnee> listeMetaDonnees = new // ArrayList<Metadonnee>(); initdatabase(); // metadonnee = new Metadonnee(new File("docs//test1.txt")); liste = new Liste(); }
e7682704-d266-448d-9004-51c7e3a87b5d
7
public void paintComponent(Graphics g) { super.paintComponent(g); // paints background Iterator<TransparentImageLevel> iter = _imgLevels.iterator(); while (iter.hasNext()) { TransparentImageLevel layer = iter.next(); if (layer != null && layer.isVisible()) { g.drawImage(layer.getImg(), 0, 0, _widt...
38de9f34-3404-4d40-ba68-6c982daefd01
7
public boolean[] exists(String... titles) throws IOException { // @revised 0.15 optimized for multiple queries, now up to 500x faster! // TODO: remove dependence on ParserFunctions StringBuilder wikitext = new StringBuilder(15000); StringBuilder parsed = new StringBuilder(1000); ...
67b68b66-8ac1-4f78-b2af-0147112c775e
3
public static boolean looksLikeCoordinate(String str) { if(str != null && (str.contains(POINT_PREFIX) || str.matches("[\\s]*[0-9\\-.]+[,\\s]+[0-9\\-.]+[\\s]*"))) return true; return false; }
fad33875-4724-4246-af83-6aa75a965894
7
public boolean containsFieldAliasDirectly(String fieldName, String typeSig, IdentifierMatcher matcher) { for (Iterator i = fieldIdents.iterator(); i.hasNext();) { Identifier ident = (Identifier) i.next(); if (((Main.stripping & Main.STRIP_UNREACH) == 0 || ident .isReachable()) && ident.wasAliased()...
57d02902-5c94-4f77-b81f-900976f3970f
6
public void initializeFromReference(){ // ints for(int i=0;i<reference.getInts().size();i++) addIntForKey(0,reference.getInts().get(i)); // doubles for(int i=0;i<reference.getDoubles().size();i++) addDoubleForKey(0.0,reference.getDoubles().get(i)); // bool...
ad38e97d-06ab-430e-b186-6b7eab708823
8
@Override public List<Device> getAllDevices() { Connection conn = null; PreparedStatement st = null; ResultSet row = null; List<Device> devices = new LinkedList<Device>(); try { conn = OracleDAOFactory.createConnection(); st = conn.prepareStatement(GET_ALL_DEVICES); row = st.executeQuery(); while...
b2fc3cb3-8494-43b0-b566-bacc953777ea
7
protected static void defineLookAndFeel() { try { try { if (OsEnum.getOS() == OsEnum.WINDOWS_VISTA || OsEnum.getOS() == OsEnum.WINDOWS_XP || OsEnum.getOS() == OsEnum.WINDOWS_SEVEN) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Cla...
381a3157-dde6-48dc-bd8c-cb2e0d3ea010
7
public int compareTo(AttributeLocator o) { int result; int i; result = 0; // 1. check type if (this.getType() < o.getType()) { result = -1; } else if (this.getType() > o.getType()) { result = 1; } else { // 2. check indices if (this.getAllowedIndic...
5c52641d-c7b9-4431-b9af-9c89e06a6f42
5
private Posizione getNearEnemyPezzo(Model m, Posizione miapos, boolean isdama){ int mrow=0 , mcol=0; int gradoVicinanza = 12; //System.out.println("####HO CHIAMATO LA FUNZIONE NEARENEMY!!###"); //Scansiono la damiera in cerca del pezzo nemico più vicino non immobile for(int i=0;i<m.getDamiera().getDim();i+...
85725a7d-fb19-4708-b6f6-111d6c23dcb1
5
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld keepspawninmemory <worldname> <true|false>"); } else if (!hasWorld(worldName)) { reply("World not found: " + wor...
6354bf85-c132-49b4-bc87-6c6fc8746d6a
9
public int getWinType() { if(isRoyal()) { return WIN_ROYAL; } if(isStraightFlush()) { return WIN_STRFLUSH; } if(isFourOfKind()) { return WIN_FOUROFKIND; } if(isFullHouse()) { return WIN_FULLHOUSE; } ...
f02742f6-7187-4a64-812d-a9f19798d86f
7
private String[] getSQLCommandStructure(String SQL_COMMAND) { String SQL_COMMAND_STRUCTURE = "", Single_Quoted_String_value, Double_Quoted_String_value, Number_value, End_char, Variable_name, Variable_value, DATA_TYPE; String[] SQL_COMMAND_STRUCTURE_VARIABLES = new String[1000]; Matcher existMat...
dde1b86c-1914-44c7-82d9-1b300e08127b
3
private void GenreAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GenreAddButtonActionPerformed String movGenre = GenreNameTextField.getText(); boolean isWord = true; System.out.println("1"); isWord = Pattern.compile("[A-Z].*").matcher(movGenr...
c899fbb4-088d-4d16-96f4-343d6637bdc6
8
public void update(boolean up, boolean down, boolean left, boolean right, Dimension d) { //check for movment if(up){ this.setPlayerY(this.getPlayerY()-3); checkAni(iipU); } else if(down){ this.setPlayerY(this.getPlayerY()+3); checkAni(iipD); } if(left){ this.setPlayerX(this.getPlayerX()-3);...
8a6eec8e-17c1-4ada-a838-20a8d1a01bee
1
public static void appendSuccess(String message) { try { console.append(message + NEWLINE); int pos = console.getText().lastIndexOf(message); console.getHighlighter().addHighlight(pos, pos + message.length(), new DefaultHig...
54ae0802-1130-47d2-a835-f3e04d856cb8
1
public void start() throws Exception { final String usage = "trouble-tunnel <config file> [ admin port ]"; if (args.length == 0) { error("no cmdline args found"); throw new Error(usage); } ConfigParser.parse(new File(args[0]), new MainConfigHandler(working_directory, routes)); }
394dead5-3362-47af-8c4b-6db61fdbc174
8
protected int parseCharacter( int c ) throws IOException { // A single character in a char-literal can be: // [U+0020 - U+0026] | [U+0028 - U+005B] | [U+005D - U+007E] | escape-char // // The first character is passed to us because we already // read it. if( c == '\\' )...
359d0934-e5ac-4480-914d-9584e3dc87d8
6
public void updateInv(){ if((getPlayer())!=null){ if(isInEventWorld()){ if(!eventInv){ normalInv.update(); if(!hasInvBypass()){ normalInv.update(); setInv(eCoreInv); eventInv = true; nonEventMode = getPlayer().getGameMode(); getPlayer().setGameMode(GameMode.ADVENTURE); ...
7c09ed5e-eae0-4796-bbeb-25f795b9bba2
1
public int ajouterPartie(Match match){ if(liste.size() < nbMatchsMaximum) { liste.add(match); } else System.out.print("Match maximum atteint"); return match.getId() + 1; }
020bb1e8-cc4b-4682-a717-d4224bcccbff
8
public svm_node[] extractEyesTemplate(int x0,int y0,int x1,int y1) { int xDistance,yDistance; int startX,startY; int currentX,currentY; int Ox,Oy; double xRes,yRes; double offsetY; double scaleFactor; svm_node node; svm_node template[] = new svm_node[735]; /* template size is 21*3...
85e10876-ec7b-4d9c-85d0-c7844a7aa8cf
7
public boolean move(Direction d){ if(d == Direction.ABOVE || d == Direction.BELOW){ if(d==Direction.ABOVE && map.get(pos.x,pos.y).tileType.ID == GameMap.STAIRSUP){ entityManager.goUp(); } else if(d==Direction.BELOW && map.get(pos.x,pos.y).tileType.ID == GameMap.STAIRSDOWN){ entityM...
9562d7da-a835-4f54-9e35-ec6de813b632
8
public static String getStatName(int idx) { switch(idx) { case S_HP: return "HP"; case S_ATTACK: return "Atk"; case S_DEFENCE: return "Def"; case S_SPEED: return "Spd"; case S_SPDEFENCE: ...
40268962-8724-4c52-b8c7-a01a3f1dd82d
3
static void receiveBytes ( final Socket sock, final int expected ) throws IOException { @SuppressWarnings ( "resource" ) InputStream in = sock.getInputStream(); int toExpect = expected; char firstChar = 'A'; int available = in.available(); if ( available == 0 && expect...
2d369e90-9873-4aa0-aeff-fa894e235b9c
0
public void logout(){ authenticationModelBS.logout(); }
0acaf207-038f-4908-b073-c241abda2d9c
5
public void loadConfig( String confFileName ) throws Exception { configMap = ( Map )JSON.decode( MStringUtil.loadStrFromFile( confFileName ) ); debug( configMap ); if( !configMap.containsKey( "zone" ) ) { throw new Exception( "\"zone\" not found on the configuration file." ); } else { zone = ( String )configMap.g...
d100cd4c-840d-4fda-a771-cc4ab299a1c4
3
public final boolean isValidAssetType(Class<?> clazz, String name) { boolean isValid = true; // Check we have a matching factory for this class if (!factoryList.containsKey(clazz)) { logger.error(new NullPointerException(), "Factory for type ", clazz, " not registered with the asset manager!"); isVali...
fa1f900c-b222-47fb-8c00-bceec8402fee
5
public static boolean isPrime(long x) { if (x == 2) { return true; } if (x % 2 == 0 || x == 1) { return false; } for (int i = 3; i * i <= Math.abs(x); i += 2) { if (x % i == 0) { return false; } } return true; }
62e5389d-2358-4f76-bb68-1e32c2507a4f
1
public StageFlipper init(StageFlipper sf) { tg = new TiarGUI(); tg.render(this.userName); this.saveMsg = sf; for (int i = 0; i < tg.game.length; i++) { tg.game[i].addMouseListener(this); } tg.startGame.addActionListener(this); tg.chat.field.addActionListener(this); tg.leaveGame.addActionListener(t...
868944ec-7a5f-437a-a314-f1cacd70754e
3
private static double getAlpha(int m) { switch (m) { case 16: return 0.673; case 32: return 0.697; case 64: return 0.709; default: return 0.7213/(1.0 + (1.079/((double)m))); } }
1ab4fcc7-b773-4a0a-9708-5b8b50e8ad1b
3
@Test public void executeScenario() throws UnknownHostException { logger_.info("[Repair Scenario 1 Start] Peer on \"0\" repairs single peer on \"1\""); Injector injector = ScenarioSharedState.getInjector(); routingTableInit(injector); LocalPeerContext context = injector.getInstance(...
ab53099e-4bf9-43c0-9189-b4be08b447b3
3
public void tick(Level level, int xt, int yt) { if (random.nextInt(40) != 0) return; int xn = xt; int yn = yt; if (random.nextBoolean()) xn += random.nextInt(2) * 2 - 1; else yn += random.nextInt(2) * 2 - 1; if (level.getTile(xn, yn) == Tile.dirt) { level.setTile(xn, yn, this, 0); } }
978c9cc8-7780-47ac-8298-effa34a86b07
8
public FileScript(final File f, final int interval) { waitTime = interval; BufferedReader r = null; final LinkedList<URI> list = new LinkedList<URI>(); try { r = new BufferedReader(new FileReader(f)); String s; while ((s = r.readLine()) != null) { ...
569e9b72-b8ab-46ab-86a9-333f7cf1271a
4
final public void Multiplicative_operator() throws ParseException { /*@bgen(jjtree) Multiplicative_operator */ SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVE_OPERATOR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { ...
2ab4f797-10e5-4667-88d0-65214b42eda0
0
public CheckResultMessage check4(int day) { return checkReport.check4(day); }
453dd7f6-9cd1-469d-9fb8-0089e8338600
4
public void loadSingleImage(String fnm) throws ConfigException { String name; if(VectorWorld.DEBUG_LOAD_IMG) { System.out.println("Loading image from file: " + IMAGE_DIR + fnm); } try { name = getPrefix(fnm); } catch (FileNameException ...
d55bf474-0e38-4899-a774-ab9411bc6023
3
public static void createTries(LinkedList[] lists, Trie[] tries){ Thread[] trie_threads = new Thread[26]; WordNode temporary_node; Trie temporary_trie; for (int i = 0; i < 26; ++i) { temporary_node = lists[i].getHead(); temporary_trie = tries[i]; trie_threads[i] = new Thread(new CreateTrieThread...
88161115-68c2-466f-bb5a-e1041e2cb604
1
private static String makeRequestString(final Object command) { if (command instanceof CycList) { return ((CycList) command).cyclify(); } else { return command.toString(); } } } /** * Converses with Cyc to perform an API command whose result is returned as a boolean. * ...
b6a32683-1f86-48c4-baa0-ec8def9eca55
1
@Override public void redo() { JoeTree tree = node.getTree(); node.setValue(newText); tree.setCursorPosition(newPosition); tree.getDocument().setPreferredCaretPosition(newPosition); tree.setCursorMarkPosition(newMarkPosition); tree.setComponentFocus(OutlineLayoutManager.TEXT); tree.setEditingNode(node);...
3c73d79f-7b10-4e84-a5b7-f15efc21d88a
4
@EventHandler(priority = EventPriority.HIGH) public void onQuit(PlayerQuitEvent e){ Player p = e.getPlayer(); if(!plugin.patrol.isEmpty() && plugin.patrol.containsKey(p.getUniqueId())){ plugin.patrol.remove(p.getUniqueId()); } if(plugin.pvpLoggers.containsKey(p.getUniqueId())){ Bukkit.broadcastMessage(C...
1193b98e-a2cb-44a6-a8e8-13fe4502695b
0
@Override public String toString() { return clockGroup.toString(); }
9351a59f-0d08-4f3c-91c8-cdc0d04a977a
9
public void checkConfirmation(){ if (!charName.getText().matches("^[\\w]+$")){ // Name has invalid characters gameDialog = new Dialog("Name can only have letters or numbers." + "Please re-enter"); if (confirmName != true){ // Shows error message gameDi...
7b3e878e-7078-47b3-b372-fca1a809d514
0
public void setPaid(Date paid) { this.paid = paid; }
ac02a996-7b2e-45a7-bbb4-099ae7f05432
9
public String parseLineForDate(String line) { String[] lineArray = line.split(" "); if (!Logic.isMonth(lineArray[0]) && !Logic.isMonth(lineArray[1])) { // example: Q1 2003 Abbott // Laboratories Earnings // Conference Call - Final FD // (Fair Disclosure) Wire April // 9, ...
a5145e52-afb5-44db-ab25-ca414efaedca
9
@Override public void onEnable(){ File sirilogdir = new File("plugins" + File.separator + "SiriLog"); File sirilog = new File("plugins" + File.separator + "SiriLog" + File.separator + "sirilog.log"); File sirilogconf = new File("plugins" + File.separator + "SiriLog" + File....
ce9b24cb-1d93-4ce0-a776-d3cb103b50e2
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
535b2a0d-66db-4cf4-9600-22dfb4549bd0
5
Marker random(int readLen) { // Random number long chrPos = Math.abs(rand.nextLong()) % genomeSize; //--- // Select a chromosome //--- long pos = chrPos; Chromosome chromo = null; for (Chromosome chr : genome) { if (pos <= chr.size()) { chromo = chr; break; } pos -= chr.size(); } i...
c77d3386-6361-4e62-b3e9-f05f76af3df3
2
public static Test findTestById(ArrayList<Test> tests, int id) { for(Test test:tests) { if(test.getId()==id) { return test; } } return new Test(); }
18a05493-f32e-4243-9788-8ef9a379459d
7
protected void findRoomsByDisplay(MOB mob, Enumeration<Room> rooms, List<Room> foundRooms, String srchStr, boolean returnFirst, long maxTime) { final long startTime=System.currentTimeMillis(); try { srchStr=srchStr.toUpperCase(); final boolean useTimer=maxTime>1; Room room; for(;rooms.hasMoreElements...
49b35ae8-1604-4e23-8892-cc308fd64e94
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...
06acf4e0-675d-4cae-9d18-23b3af026de5
7
public void addClassesFromDir(Vector classList, File rootDir, File currentDir, int recursionLevel) { if (recursionLevel >= 6) { // search only the first levels return; } String[] files = currentDir.list(); if (files != null) { ...
f9d7e0f0-152b-494b-a2d3-047bade2262c
3
@Override public void init(int maxPasJeu) { bindPersonnageJouableService(heros); bindPersonnageJouableService(kidnappeur); bindTerrainService(plateau); plateaujeu.init(15, 13); pasJeuCourant = 0; maxiPasJeu = maxPasJeu; heros.init(1, 1, PersonnageType.HEROS); heros.setForceVitale(3); heros.setBombe(1...