method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
df2053e1-0663-4974-94f0-7f1f60790147
7
public Map getLocation(String ip) { country = ipSeeker.getCountry(ip).replace("CZ88.NET", "").replace("错误的IP数据库文件", "").replace("局域网", ""); area = ipSeeker.getArea(ip).replace("CZ88.NET", "").replace("错误的IP数据库文件", "").replace("对方和您在同一内部网", ""); boolean isChina = false; if (country != nul...
6666517c-80b7-414b-a453-da4ef57a8e07
4
public static RequestLine parseRequest(byte[] requestData) throws IllegalArgumentException, FileNotFoundException { if (requestData.length == 0) { throw new IllegalArgumentException("Empty request-line."); } String request; try { request = new String(requestData, "US-ASCII"); } catch (UnsupportedEncodin...
fcc4d05d-8ecf-42fe-a4ee-ea7057735a03
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
d2618da5-da20-435b-95e8-4f16ba51b54c
1
public URL find(String classname) { String cname = classname.replace('.', '/') + ".class"; ClassLoader cl = (ClassLoader)clref.get(); if (cl == null) return null; // not found else return cl.getResource(cname); }
d82ad7b3-53b9-47c0-b0d9-f8ee0a34a0f0
5
private void tryToSave(KDNode node, double[] target) { if(node == null){ return; } double distance = distance(target, node.values); if(resultKNN.size() == k && resultKNN.maximum().distance < distance){ return; } KNNPoint point = new KNNPoint(node.values, distance); if(resultKNN.contains(point))...
754efba9-ca89-4381-9eea-cb415a38817e
7
private ArrayList<ArrayList<Integer>> twoSumInternal(int[] numbers, int target, int startpos) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if(numbers.length<2) return result; HashMap<Integer, Integer> maps = new HashMap<Integer, Integer>(); int lastUniqe = numbers[0]...
7f43a613-7800-4bc8-9827-44fab0a4ea47
9
public String trapHere(MOB mob, Room R) { final StringBuffer msg=new StringBuffer(""); if(CMLib.flags().canBeSeenBy(R,mob)) msg.append(trapCheck(R)); for(int d=0;d<Directions.NUM_DIRECTIONS();d++) { final Exit E=R.getExitInDir(d); final Room R2=R.getRoomInDir(d); if((R2!=null) &&(E!=null) &&(...
63ab54b3-cc5c-4c5b-b07c-9f99f4cfbbad
9
public State iterate(SimpleNode root) throws ParseException { SimpleNode nodeChild = null; StateQueue cur = stateQueue.element(); if( cur == null ) return null; for(int i=0;i<root.jjtGetNumChildren();i++) { nodeChild = (SimpleNode) root.jjtGetChild(i); if( nodeChild == null ) con...
fd0984fc-a199-49b4-b7d4-5bed1817d6c9
5
public void createControlPanel(Composite parent) { super.createControlPanel(parent); if (nextNumber < 1) nextNumber = startNumber; // add selection listener to reset nextNumber after // the sequence has completed playItem.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event)...
c0a6665f-e5e1-4f9b-9c1b-0a670507fe02
9
int insertKeyRehash(int val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look un...
60975208-fedf-45a8-bccf-bc4e0c27aae1
1
private int calcActualFreq(int freq) { if (mMaxCount < freq) freq = mMaxCount; return 1+(int)((64*1024 - 1) * (((double)freq)/((double)mMaxCount))); }
37f06c8e-601f-46fb-88ec-5cedc2259fb9
5
public void binarySearch(int key, int start, int end, List array){ System.out.println("key: "+key); System.out.println("start: "+start); System.out.println("end: "+end+"\n"); int position; int comparisonCount = 0; position = (start + end) / 2; while(list.get(position) != key && start <= end){ ...
73440966-5b9a-4f0f-ae5b-81c13533132e
6
void printZigZagBT(BTnode root) { BTnode tmpNode; Stack<BTnode> tmpStack; if(root == null) return; currentLevel.push(root); while(!currentLevel.empty()) { tmpNode = currentLevel.pop(); if(tmpNode != null) { if(leftToRight){ System.out.println(tmpNode.data); nextLevel.add...
18b60b9b-900d-4d80-9cac-8db889ac207a
3
public void setEntries(List<CommsLogEntry> entries) { if(entries == null || entries.size() == 0) { this.entries = new ArrayList<CommsLogEntry>(); this.entries.add(new CommsLogEntry(CatanColor.WHITE, "No messages")); } else { this.entries = entries; } if (this.getWidth() > 0) { updateSize...
bddd17d1-8284-4d28-8be5-51e1b82a2229
3
private boolean isError(int winner, String date, DBService dbService) { try { String qTore = "CREATE OR REPLACE VIEW tore AS SELECT goalshome AS goals, mdate FROM blmatch WHERE home_team = " + winner + " AND mdate < \'" + date + "\' UNION SELECT goalsguest AS goals, mdate FROM blmatch WHERE guest_te...
c6da9566-1c87-42da-8959-5445a90a9d74
7
public void generate(JFormatter f) { f.p("/**").nl(); // prints the main body format(f," * "); for (Map.Entry<String,JCommentPart> e : atParams.entrySet()) { f.p(" * @param ").p(e.getKey()).nl(); e.getValue().format(f,INDENT); } if( atReturn != null...
5dd0fced-e440-42cc-b776-d584daeeecb6
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
b9a9437e-bf4f-4a40-bcb2-223ff781de16
1
public void updateSubTypes() { if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) GlobalOptions.err.println("setType of " + local.getName() + ": " + local.getType()); local.setType(type); }
c06e3f7d-ff95-420e-a149-cb3762f47087
3
public static void loadFile(File file, FileConfiguration fileConfig) { try { fileConfig.load(file); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { e.printStackTrace(); } }
6d928725-3188-4b2a-bf6b-de7449ad3238
8
public void rotateBlock() { boolean rotatable = true; int counter = 0, adjust = 0; int newPose, newWidth, newHeight; int[] newx = new int[4]; int[] newy = new int[4]; newPose = (currentBlock.brickPose + 1) % NumPoses; newWidth = bricks[currentBlock.brickType][newPose].w; newHeight = bricks[currentBl...
4120af43-dfb6-4c17-99c3-59d20b766ad8
3
public String getFrench() // Plural? { if (gender != Gender.NEUTRAL) { if (startsWithVowel(french)) { return "l'" + french; } return (gender == Gender.MASCULINE ? "le " : "la ") + french; } return french; }
62f1354f-9cfe-412e-bc4b-dbb5214f1d65
0
public String value() { return value; }
2307b6fb-9ced-43c8-a002-35fe1e6b8bda
0
public void setContestId(Integer contestId) { this.contestId = contestId; }
e4460d67-6f07-4165-989b-5abce70ad7e6
6
@SuppressWarnings("rawtypes") public void processStimulus(Enumeration criteria) { // Copy physics into scene graph for (Iterator<RigidBodyContainer> it = rigidBodies.iterator(); it .hasNext();) { RigidBodyContainer container = (RigidBodyContainer) it.next(); container.transformGroup.setTransform(containe...
7142e45b-6705-4bfc-9f4d-49c460ba111e
3
int getFreePositions() { int count = 0; for(int i=0;i<sudokuSize;i++) { for(int j=0;j<sudokuSize;j++) { if(cells[i][j].valueState == 0) count++; } } return count; }
2f7335af-21ee-4437-86fd-28460764ffe5
6
@EventHandler public void WitchJump(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWitchConfig().getDouble("Witch.Jump.DodgeCha...
0dfa93f8-1a9e-4f8e-a5a8-3940f2214fea
0
public static void setMaxAge(int newMAX_AGE) { MAX_AGE = newMAX_AGE; }
a11e0a94-b153-48b6-9115-0450add65967
1
public void uninitializeService() throws Exception { EventObject e = new EventObject(this); for(IServiceListener listener : this._listeners) { listener.serviceUninitialized(e); } }
8f5654c1-fa1b-40f9-b714-0b8c4c81c37e
4
@Override protected void multiplyAttribute(EntityAttribute attribute, double totalMultiplier) { switch (attribute) { case HEALTH_REGEN: healthRegenCooldown = (int) ((double) baseHealthRegenCooldown / totalMultiplier); notifyListenersAttributeChanged(attribute, healthRegenCooldown); break; case MANA_REGE...
60131d2d-0103-4018-88eb-ec58cfe1504d
5
private InputStream nextLine() throws IOException { try { String line = null; while (lines != null && line == null) { line = lines.poll(1L, TimeUnit.SECONDS); } if (line != null) { return new ByteArrayInputStream((line.endsWith("\n") ? line : line + '\n').getBytes()); } else { return new By...
b9572d26-33a7-4d32-aaaa-a032feec9146
0
public List<OrderLine> getLineeOrdine() { return lineeOrdine; }
911387ce-b314-4117-802b-c0af01306daa
8
public void redistributeVotes(int quota, Seat[] seats) { if (votes() >= quota) { status = Status.WON; double transferable = 0; for (WeightedVote v : votes) if (v.lookNext() != -1) transferable += v.getWeight(); double factor = (votes() - quota) / transferable; for (WeightedVote v : votes) ...
f4a1b1ab-de58-42af-a01b-89288bd2a768
3
private void makeLoginMenu(){ mnLogged.setText("Logged in as: "+user.result.username); mnGroove.remove(mntmLogin); try { playlists = JGroovex.userGetPlaylists(user.result.userID).result.Playlists; } catch (IOException e) { e.printStackTrace(); } if (playlists.length == 0) mnPlaylist.add(new JMen...
8e249e31-976c-42a5-b354-d2d1329cc0b3
5
public boolean moveUnit(Position from, Position to) { // Units teleport (no check of allowed path) if (!getUnitAt(from).getOwner().equals(player)) { return false; } if (!validPosition(to)) { return false; } if (getUnitAt(to) != null) { if (battleStrat.battle(from, to, this)) { // From wins ba...
bbc8140a-7b2c-4af2-a14a-b6f9e7048674
4
public void leeArchivo() throws IOException { BufferedReader fileIn; try { fileIn = new BufferedReader(new FileReader(nombreArchivo)); } catch (FileNotFoundException e){ File puntos = new File(nombreArchivo); PrintWriter...
19fb8f88-4c97-43dc-8c08-c51d67250d28
4
static void stack(String str) { System.out.println(str + "\n"); char[] byteString = str.toCharArray(); int size = byteString.length; Stack<Character> stack = new Stack<Character>(); for(int i = 0; i < size; ++i) { switch(byteString[i]) { case '+': ...
511f57b5-1344-4114-b93b-008f5412b119
2
public List<Planet> MyPlanets() { List<Planet> r = new ArrayList<Planet>(); for (Planet p : planets) { if (p.Owner() == 1) { r.add(p); } } return r; }
64cea410-12a9-4a55-899f-4870663dc334
2
@Override public void openSelection() { if (mOpenableProxy != null && !mSelectedRows.isEmpty()) { mOpenableProxy.openSelection(); } }
09ed978c-ea61-428d-aaeb-16289bd00661
6
public static void resizeAll(float aScaleFactor){ // Check whether the current slide is a quiz slide if (null != currentQuizSlide){ if (correctnessTextPlayer != null) correctnessTextPlayer.resize(aScaleFactor); // Resize quiz elements scoreTextPlayer.resize(aScaleFactor); answerBoxA.resize(aScaleF...
edea8725-9e81-4310-b02b-24803b6ad5f4
9
public void run() { try { while(s.isConnected() && in != null) { Serializable data = null; try { data = (Serializable) in.readObject(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); ...
5179e38d-bdd6-4677-b1c1-ed922d7b0b9c
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...
2619acad-a5d6-40bb-9a7c-956a347cac33
3
@Override public Seat getResearvedSeat(Passenger passenger) { for (int i = 0; i < passengerList.size(); i++) { List<Passenger> _rowIteretor = passengerList.get(i); for (int j = 0; j < _rowIteretor.size(); j++) { Passenger _passenger = _rowIteretor.get(j); ...
e615971b-781e-4e49-9a81-db5845f3a268
0
public void setConnection(Connection connection) { this.connection = connection; }
a0605d9d-f31d-4033-8122-b9dc103d54a0
3
private Config() { //TODO: IMPORTANT! Catch all exceptions of Preferences try { Preferences root = Preferences.userRoot(); preferences = root.node("arietta"); interfaceWindowConfig = new UI.WindowConfig(); fetchPreferences(); } catch (SecurityExc...
21d882ef-c35d-4051-a3a5-5e36575910de
3
public static String legacyPingMOTD(boolean colours) { String message = pingMOTD; if(message.contains("\n")) message = message.substring(0, message.indexOf("\n")); if(!colours && message.contains("§")) { Matcher m = mStripPattern.matcher(message); message = m.replaceAll(""); message = message.re...
59c7beaf-bc58-4925-9c08-7c96eb8b09ba
8
private void updateResidueMap(String structure) { String model = structureToModelMap.get(getStructure(structure)); String chain = getChain(structure); String spec = " #"+model+":."+chain; Map<Integer, String> sequenceNumberMap = new HashMap<Integer, String>(); // This requires Java 7 /* Pattern p = Pattern....
4f6f4a5a-a0f6-43e0-ba53-fa28c4954f56
7
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((departamento == null) ? 0 : departamento.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((funcao == null) ? 0 : funcao.hashCode()); result = pr...
7b8f1614-1675-486c-9554-9bd5e8846d3d
1
public void testPlayCalmLoop() throws Exception { System.out.println("playCalmLoop"); MusicController instance = new MusicController(); instance.playCalmLoop(); for(int i=0;i<30;i++){ System.out.print(i+" Seconds passed"); Thread.sleep(1000); } ...
d28bcd11-66f0-4fcd-a60f-ce183fc65e81
5
public void wipeSavesAfter(String option) { // // Delete any subsequent time-stamp entries. boolean matched = false ; for (String stamp : timeStamps) { if (matched) { timeStamps.remove(stamp) ; final File f = new File(fullSavePath(savesPrefix, stamp)) ; if (f.exists()) f.delet...
a9670ce2-1bc2-4caa-88c1-071f66d429a0
3
public final char nextClean() throws JSONException { for (;;) { char c = next(); if (c == 0 || c > ' ') { return c; } } }
23f140ec-2d05-4c6d-9a2a-ef3c9487b281
2
public static Object toObject(byte[] bytes) throws IOException, ClassNotFoundException { Object obj = null; ByteArrayInputStream bis = null; ObjectInputStream ois = null; try { bis = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bis); ob...
3977c2e6-65a2-4f8c-a11d-88a48255c938
6
public static void main(String[] args) throws Exception { //add your code here BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ArrayList<Integer>(); for (int i=0; i<20; i++) list.add(Integer.parseInt(reader.readLine())); ...
8adc6038-d957-4174-96a3-83abec3035a9
1
public WallDecoration getWallDecoration(int i, int k, int l) { GroundTile groundTile = groundTiles[l][i][k]; if (groundTile == null) { return null; } else { return groundTile.wallDecoration; } }
de0c5cfb-8393-49ec-bc45-f699fbce92f7
7
static String getNextIP() { int high, low; synchronized(counter) { do{ do { high = (counter>>8) & 0x00FF; if(high < 10 || high > 200) { counter += 256; } } while(high < 10); low = counter & 0x00FF; counter ++; } while ( high < 10 || high > 200 || low < 10 || low > 200...
c71fb222-04ed-408e-9121-c72ac0d9e000
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(CMLib.flags().hasAControlledFollower(mob, this)) { mob.tell(L("You can only control one golem.")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return fal...
8821ac1e-c0e3-41f8-9eeb-d2dfa7c5e822
9
public boolean execute(){ if (deque == null) { throw new IllegalStateException("You must parse the code before executing."); } if (!canExecute) { throw new IllegalStateException("Cannot execute code now. Not compiled, or" + " execution reached error, or execution reached end."); } if(deque.isEmpty...
d84ba720-2995-4abc-a5a9-fdc2aa8ab89d
6
public double calcTotal(){ double result = 0.0; double lineTotal = 0.0; int lineCount = 0; String filePath = "/Users/andrewho/Documents/Programming/Week16/Temperatures.csv"; File file = new File(filePath); BufferedReader in = null; try { if(!file.exist...
3cd264a8-5444-412f-9ae6-d9db99bbf274
6
public boolean method577(int i) { if(anIntArray776 == null) { if(anIntArray773 == null) return true; if(i != 10) return true; boolean flag1 = true; for(int k = 0; k < anIntArray773.length; k++) flag1 &= Model.method463(anIntArray773[k] & 0xffff); return flag1; } for(int j = 0; j < a...
1c8c5a67-2301-4348-81f8-d79c9894335a
4
@Override public void run() { while(true) { if (in.hasNext()) { String temp = in.nextLine(); for (ServerCommands c : ServerCommands.values()) { if ((temp.toLowerCase()).contains(c.getValue().getCommandText())) { c.getValue().execute(temp); } } } } }
5cb721c3-d7c8-463d-8697-4bf2d23074ee
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Veiculo other = (Veiculo) obj; if (codigo == null) { if (other.codigo != null) return false; } else if (!codigo.equals(other.codigo)) ...
95428f96-6dd1-4d85-a041-ca14a96b12de
1
public boolean release(long id) { if(enemyID == id) { enemyID = NO_ENEMY; return true; } else { return false; } }
d4f5fe93-a8d5-4307-9fe3-0ce45c353f3a
7
public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message) throws GranException { List<SecuredMessageBean> allMessages = message.getTask().getMessages(); // List<String> users = KernelManager.getStep().getHandlerList(message.getMstatusId(), message.getTaskId()); String fi...
7af77b7a-edcc-450a-a97b-68aa3276aa4f
9
void loadSchematics() { schematicsList.put(schematicsList.size(), "BasicHouse"); schematicsList.put(schematicsList.size(), "Temple-Japonais"); for (int o = 0; o < schematicsList.size(); o++) { InputStream input = getClass().getResourceAsStream( "/resources/Schematics/" + schematicsList.get(o) + ".s...
597fae3b-083d-4d15-930e-5b3258e1f5c1
7
public static void main( String[] args ) throws Exception { BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); String stdin; while( true ) { stdin = reader.readLine(); if( stdin == null ) { return; } final byte[] buf = new byte[ 1024 * 20 ]; //20KB String fileContent = new Stri...
328a7289-02e6-400c-af32-c466b95055cd
9
int insertKeyRehash(short val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look until FREE slot or we start to loop...
20e1a345-bffd-4a1d-a45b-71753dd0c746
9
private static String checkLabelName(CompileInfo ci, String name){ name = name.trim(); if(name.isEmpty()){ makeDiagnostic(ci, Kind.ERROR, "empty.label", name);//$NON-NLS-1$ return "!error!"; } for(int i=0; i<name.length(); i++){ char c = name.charAt(i); if(!((c>='A' && c<='Z') || (c>='a' && c<='z') ...
4dc5b1b0-510b-4cdf-969f-d1b4e11507aa
0
public boolean isWaiting() { return waiting; }
b8b780d9-6a22-4b20-81c5-304d5d694c96
8
protected void paintRaisedBevel(Component c, Graphics g, int x, int y, int width, int height) { Color oldColor = g.getColor(); int h = height; int w = width; g.translate(x, y); g.setColor(getHighlightOuterColor(c)); if (hidenSide != BorderLayout.WEST) g.drawLine(0, 0, 0, h - 2); if (hidenSide != Bor...
6ef3d9a8-4be5-413a-a374-992b0fa786aa
2
private static void writeBytes(BufferedWriter bw, byte[] tab) throws IOException { for (int i = 0; i < tab.length; i++) { String val = Integer.toHexString(0x000000FF & tab[i]); if (val.length() < 2) { val = "0" + val; } bw.append(val); } ...
597feef7-369f-4bbe-9970-660ed4461172
4
@Override public List<Double> transform(List<Double> in) { if (in.size() != inputMins.size()) { throw new MLException(String.format( "Unexpected in-vector size. Expected: %d, Got: %d", inputMins.size(), in.size())); } List<Double> out = new ArrayList<Double>()...
2eb428c0-a337-43d2-b2da-4433138e9f4a
8
public JKeeperXML2JTree(Document document) { treeModel = new JKeeperTreeModel(); Node root = document.getDocumentElement(); int whattoshow = NodeFilter.SHOW_ALL; NodeFilter nodefilter = null; boolean expandreferences = false; DocumentTraversal traversal = (Docum...
532b8c7a-e525-4248-b6d3-6799b062c489
8
public int aggregateResults() { if(!baseDir.toFile().exists() || !baseDir.toFile().isDirectory()){ System.out.println("The specified path does not point to a directory"); return -1; } File[] projectFolders = baseDir.toFile().listFiles(new FileFilter() { @Override public boolean accept(File arg0) ...
941c289b-e670-4121-8946-dee5b12e3064
3
public TableView<Share> setTableView(final AccountManager account){ TableView<Share> table = new TableView<Share>(); List<Share> namelist = new ArrayList<Share>(); for (Share share : account.getPriceProvider().getAvailableShare()) { namelist.add(share); } ObservableList<Share> data = FXCollections.obs...
d21220c2-23f9-4b7c-9d0d-da1549b66ad4
7
public static List findAll(Element tree, String path) { if(tree==null || path==null) return new ArrayList(); //防止产生Null异常 if(path.charAt(0)=='/') path = path.substring( path.indexOf('/', 1)+1); String[] paths = path.split("/"); for(int i=0; i<paths.length-1; i++) { tree = tree.getChild(paths[i]); ...
66ec3f44-85b4-4866-8297-181cc666d9e1
6
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String action = request.getParameter("act"); if(action != null) { try { RequestContext context = new RequestContext(request); if(context.isLogged(...
0f6a3b41-356a-401d-a609-c307b4fa15c1
9
public String labelData(String srcfile,String statusFile) throws IOException{ HashMap<String,Integer> statusMap = new HashMap<String, Integer>(); BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(statusFile), "GBK")); String line; String[] arr; while((line = br.readLi...
181f45aa-b182-4e74-a61e-b509505de3e2
8
public static final TCache instance(Properties p){ TCache cache = null; CacheType cacheType = null; if(p == null || !p.containsKey(TCache.CACHE_TYPE_KEY)) { cacheType = CacheType.CACHE; }else{ String tmp = p.getProperty(TCache.CACHE_TYPE_KEY); if(tmp.equals(CacheType.STORE.toString())){ cacheType ...
f651d665-b2c7-43f7-bcb6-d4c2f95d96bb
0
public static void printInfo() { System.out.println("FileToPNG conversion tool"); System.out.println("\"Core Version\": "+((int)VERSION & 0xFF)); System.out.println("USAGE:"); System.out.println("java -jar filetopng.jar [input file] [direction] [output] [deflate]"); System.out.println(); System.out.println(...
ad983b6e-18fc-4f64-83f4-5b245f0ae4a5
3
public static double abs_max(double var0, double var2) { if(var0 < 0.0D) { var0 = -var0; } if(var2 < 0.0D) { var2 = -var2; } return var0 > var2?var0:var2; }
36e222e7-452e-465d-bd97-58a683d0bd5d
0
public void imbue() { }
eb6e8900-86f0-481b-8819-08d922c8e1f9
8
public void keyReleased(KeyEvent ke) { int kc = ke.getKeyCode(); if(kc == KeyEvent.VK_RIGHT || kc == 68) p.input.remKey(Input.RIGHT); if(kc == KeyEvent.VK_LEFT || kc == 65) p.input.remKey(Input.LEFT); if(kc == KeyEvent.VK_UP || kc == 87) p.input.remKey(Input.UP); if(kc ...
85224963-f254-4262-9698-7ac8aad1c1fc
1
public Object invoke() { try { return method.invoke(self, parameters); } catch (Exception ex) { throw new PatternException("Exception during invocation of `" + self.getClass() + "#" + method.getName() + "`", ex); } }
5e64ef4c-b1f1-4790-a9b4-b8da58a9cbd0
2
private void getJob() { System.out.println( client.getRemoteSocketAddress() + " has requested a job"); Job job = queue.getNextJob(); if(job == null){ // Tell them that we have no job out.println(Command.NO_JOB); }else{ out.println(Command.HAVE_JOB); ...
54bff4de-baf9-427a-a60c-eea0f7c508d6
7
private static double oper(double a, double b, Operation op){ if (a == -1 || b == -1) return -1; switch (op){ case ADD: return a+b; case SUB: return a-b; case MULT: return a*b; case DIV: ...
3eeafe34-f9ca-47b3-a995-7a6bebfd52ae
9
@Override public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { StyledText styledText = viewer.getTextWidget(); if (styledText == null) { return; } final Shell browserShell = new Shell(shell, SWT.APPLICATION_MODAL); browserShell.setLayout(new FillLayout()); final Browser...
854ff4e0-3ba9-4670-932b-d8dfc2e30981
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...
1e55ffa2-38a4-40c0-ae4b-bb55d018c858
0
public static void setMaxLitterSize(int newMAX_LITTER_SIZE) { MAX_LITTER_SIZE = newMAX_LITTER_SIZE; }
bb285d63-78fe-4c4d-8bd2-87bdfcf2655f
3
public void enviarAModulo(){ int modulo = usuarioInstancia.getUsuarioIngresado().getIdModulo(); if(modulo == 1){ tpPrincipal.getTabs().add(getTabPrincipalMesero()); }else if(modulo == 2){ tpPrincipal.getTabs().add(this.getTabPrincipalChef()); }else if(modulo == 3){ tpPrincipal.getTabs().add(this.g...
024dafc4-b163-45b7-acb4-0533bb6df282
2
public Explosion(int x, int y) { this.y = y; this.x = x; width = 30; height = 30; try { BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Enemies/explosion.gif")); sprites = new BufferedImage[6]; for (int i = 0; i < sprites.length; i++) { sprites[i] = spritesheet...
da2386cb-bc63-4730-8e6b-aba211199617
1
public void actionPerformed(ActionEvent e) { // handles assign referees button being pressed if (e.getSource() == assignRefereesButton) assignReferees(); }
2f280f9e-11ef-4918-80a3-0c265f57badf
3
public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int cases=scanner.nextInt(); while (cases-->0){ int r=scanner.nextInt(),c=scanner.nextInt(); init(r,c); for(int i=0;i<r;++i){ for(int j=0;j<c;++j){ ...
31f16078-f682-4730-8c69-a2e5890f3321
9
public static String editPasswd(Display display, final Map<String,String> m, final String name) { final Shell shell = new Shell(display); shell.setText ("Edit password"); shell.setLayout (new FormLayout()); hack_string = null; Control tname; final Text tname_text; if (nam...
643a36ab-7138-44c9-8545-d1fc3898e6ed
3
public PasswdDialog(String title, boolean userDisabled, String userName, boolean passwdDisabled) { super(true); setResizable(false); setTitle(title); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { endDialog(); } }); J...
467aca5b-6a11-42c8-81b9-ca4a02d6c69f
9
private String readString() throws JSONException { Kim kim; int from = 0; int thru = 0; int previousFrom = none; int previousThru = 0; if (bit()) { return getAndTick(this.stringkeep, this.bitreader).toString(); } byte[] bytes = new byte[65536];...
324387c2-6e20-4d9f-a3dd-2df89682dbab
2
public Supplier getSupplierByName(String supplierName){ for(Person person : supplierList){ if(person.getName().equalsIgnoreCase(supplierName)){ return (Supplier)person; } } return null; }
1c655304-9ab9-4555-87e8-65b6ee04805a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Group other = (Group) obj; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other....
8669948d-a7f9-4e23-8f63-a838083930f3
6
public ArrayList<Node> readFromAdjacencyList(String file){ ArrayList<Node> network = new ArrayList<Node>(); boolean start = false; try { BufferedReader in = new BufferedReader(new FileReader(file)); String line; int s; int d; S...
3a08558d-930d-4038-bdef-9feb3f3b91a3
3
@Override public void updateState(eBattleFieldMode state) { switch (state) { case Design: playerGrid.setMode(eBattleFieldMode.Playable); oponentGrid.setMode(eBattleFieldMode.Displaying); break; // this means its players turn ...
b51f145f-3d92-4a2b-b81b-3b941e0d6be1
0
@Override public String getDesc() { return "Resurrection"; }
cd3b8f09-bf88-4678-bb26-eba5aa8cf66e
0
public JoeException(int exceptionSelector) { super ((String) exceptionMessages.get(new Integer(exceptionSelector))) ; } // end constructor JoeException