method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
43f1e2f1-6e44-4d03-ac1b-8d9bc5f5c220
7
public void prepare(CharSequence exp) throws ParseException { algorithm.clear(); final int length = exp.length(); NodeDefinition current_def = null; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < length; i++) { char current_char = exp.charAt(i); if (current_def == null) { /* ...
33bab2e3-9921-48ea-9403-d5a4c289ec5a
1
public void appendToTail(int x){ ListNode newNode = new ListNode(x); ListNode node = this; while(node.next!=null) { node = node.next; } node.next = newNode; }
07327a7a-09a4-4d41-9924-5a8958fc8054
5
public void start(BundleContext context) throws Exception { m_context = context; // Create a service tracker to monitor dictionary services. m_tracker = new ServiceTracker(m_context, m_context.createFilter("(&(objectClass=" + DictionaryService.class.getName() + ")" + "(Language=*))"), null); m_tracker.open(); ...
2817d7cb-dc03-45d9-bb1f-a49474a77446
4
public void testisEmptyLeaf(int count) throws Exception { for (int i = 0; i < 100; i++) { RBtree empt = empty(); if (!empt.isEmpty()) { throw new Exception("FAILURE EMPTY IS NOT EMPTY"); } else { int len = (int)(Math.random() * (10 - 1) + 1); RBtree tree = randomRB( len ); if (tree....
ed76f23c-dada-4cb3-866d-9406eb14f1c3
1
@Test public void shouldThrowErrorWhenCharactersAreInvalid() throws IOException { //given File tmpFile = folder.newFile(FILENAME); FileOutputStream fileOutputStream = new FileOutputStream(tmpFile, true); CharsetEncoder charsetEncoder = Charset.forName(ENCODING).newEncoder(); ...
1a4e4a6a-8c0f-4685-a6dc-c2c65de9f3ff
6
public void mouseClicked(MouseEvent me) { try { if (me.getSource() == jb_connexion) { login = jtf_login.getText(); password = String.valueOf(jpf_password.getPassword()); System.out.println("Email : "+login); System.out.println("MotDePasse : "+password); User u = null; ...
8994dec8-0302-43c1-b5e8-9feae4779e82
0
private static JMenu getHelpMenu(EnvironmentFrame frame) { Environment environment = frame.getEnvironment(); JMenu menu = new JMenu("Help"); Serializable object = environment.getObject(); //Currently commented out, but can be restored if the help menus are fixed. //addItem(menu, new EnvironmentHelpAction(env...
7892dbbd-c031-455c-9148-94e4ff26b968
3
public void start() throws GameNotInitializedException { if (!initialized) { throw new GameNotInitializedException("Game not initialized"); } while (!gameEnded) { try { // It's just a delay for display Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } playTu...
3743aeff-eac5-4c52-ad78-3f3dc4f430a2
4
public char getOrbitalLetter() { int oNum = getOrbitalNum(); if(oNum == 2) return 's'; else if(oNum == 6) return 'p'; else if(oNum == 10) return 'd'; else if(oNum == 14) return 'f'; System.err.println("getOrbitalLetter - Orbital number is out of bounds"); return '?'; }
42899526-1dae-42a9-8a03-76449a3cba08
7
private String[] getVariablesNamesInScope(Scope scope) { TreeSet<String> result = new TreeSet<String>(); /* * TODO: Frank, what to do with object/classes? For example test.test? */ boolean doneFirst = false; String suffix = "local"; do { if (!doneFirst && scope instanceof AstRoot) { suffix = "...
cba35116-379c-4e6c-af49-762308fc26a5
7
@Override public void run(int interfaceId, int componentId) { if (stage == -1) { sendEntityDialogue(SEND_1_TEXT_CHAT, new String[] { player.getDisplayName(), "Can you tell me about the battlefield?" }, IS_PLAYER, player.getIndex(), 9827); stage = 1; } else if (stage == 1) { sendEntityDial...
8eae4a41-3d7f-4140-b737-6b1e06ec0330
7
@Override protected void done(){ if(exit==0){ //If is successful, tell the user, and record it in the log file JOptionPane.showMessageDialog(Download.this,"Finsh"); } //If it is failed, show user the message else if (exit==1){ JOptionPane.showMessa...
f5c323ea-c195-4543-bc66-fddb27d25fca
3
void createExampleWidgets () { /* * Create the page. This example does not use layouts. */ int style = getDefaultStyle(); sashComp = new Composite(sashGroup, SWT.BORDER | style); /* Create the list and text widgets */ list1 = new List (sashComp, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); list1.setI...
abd709f9-c789-4090-b3ab-a075e0b04fb2
2
private String getXML() { JFileChooser chooser = new JFileChooser(); if(ProjectMainView.actualFolder!=null) chooser.setCurrentDirectory(ProjectMainView.actualFolder); FileNameExtensionFilter filter = new FileNameExtensionFilter("*.zip", "zip"); chooser.setFileFilter(filter); chooser.setDialogTitle("Choose ...
8871a581-38ca-417e-8c83-428660bcf427
7
static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 39: return jjStopAtPos(0, 9); case 40: return jjStopAtPos(0, 7); case 41: return jjStopAtPos(0, 8); case 43: return jjStopAtPos(0, 15); case 45: return jjStartNfaWithS...
9aa4e0fe-7d09-4be2-bdc8-a3a962fe5add
0
public static Venue findById(long id) throws SQLException { return findOne("id", String.valueOf(id)); }
69c6fba5-b5d1-4a59-a1c0-112f0d4b9a91
8
@Override public void run() { log("Connection accepted"); InputStream in; OutputStream out; IObjectChannel channel; try { in = client.getInputStream(); out = client.getOutputStream(); channel = channelFactory.create(out, in); channel.setLogAdapter(this); } catch (IOException e1) { throw new...
b3d5dd4e-bddc-4f26-9924-7eca2bdca921
9
@Override public void render(Value value, Object target, Class clazz, CoderContext context) throws ConversionException { if (target instanceof Map) { if (Map.class.isAssignableFrom(clazz)) { Map map = (Map) target; for (;;) { if (!value.hasMore...
a8d428d9-95bf-4ea7-8a29-1f311193b347
1
@SuppressWarnings("unchecked") public E previous() { checkForComodification(); int i = cursor - 1; if (i < 0) { throw new NoSuchElementException(); } cursor = i; return (E) get(lastRet = i); }
ea1c0855-e7f2-48f3-9401-e82a76a81d75
8
public static int findMinimumDistance(int []input, int x, int y){ int prev =-1; int i=0; int privIndex = -1; int minDistance = Integer.MAX_VALUE; //find first item which matches either of x or y for(;i<input.length; i++) { if(input[i] == x || input[i] ==y) { ...
fcc4d43b-a344-4281-9370-19c4c2cc47ae
3
public void checkScore() { switch(getScore()) { case PLAYER1: break; case PLAYER2: break; case NONE: break; } }
1fc2a662-7f61-4f12-ab7f-aa4461541842
2
public static List<Laureate> filterByCountry(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getCountry())) ...
1841ac68-5589-4fae-b193-5f15a3e3e62c
4
public boolean checkForVerticalStrike(String input) { for (int i = 0; i < boardSize; i++) { int count=0; for (int j = 0; j < boardSize; j++,count++) { if (boardArray[j][i].equalsIgnoreCase(input)) { continue; } break; ...
3cd82155-305b-4eae-b37f-eba5646b9028
7
public static boolean nativeSlotPropositionP(Proposition self) { { Vector arguments = self.arguments; if (((arguments.length()) == 0)) { return (false); } { Stella_Object firstarg = (((arguments.theArray)[0] != null) ? Logic.valueOf((arguments.theArray)[0]) : ((Stella_Object)(null))); ...
20e21c31-1192-411e-827a-e9b37330825d
7
@Override public boolean runTest(){ return ((frontBack("code").equals("eodc")) && (frontBack("a").equals("a")) && (frontBack("ab").equals("ba")) && (frontBack("abc").equals("cba")) && (frontBack("").equals("")) && (frontBack("Chocolate").equals("ehocolatC")) && (frontBack("aavJ").equals("Java...
e805eb93-7b22-4018-986b-84e1cc14d5b4
7
public String serializeToString(Element root) { StringBuilder sb = new StringBuilder("<"); sb.append(root.getTag()); String val; for (String attName : root.attributeNames()) { val = root.getAttribute(attName); sb.append(String.format(ATTRIBUTE_FMT, attName, val))...
9d79b524-84e9-4560-bdba-c37911a74616
4
@Override public boolean equals(Object obj) { if (this == obj) return true; else if (!(obj instanceof ObjectVariable)) return false; ObjectVariable ov = (ObjectVariable) obj; return (inQuotes == ov.inQuotes) && varname.equals(ov.varname) && v...
9be1dfd0-480d-4c72-982c-bdf2c6fbb9cc
5
@Override public void execute() { if (args.length == 0) p.openInventory(cm.getMain().getLM().getInventory()); if (args.length == 1) { if (Permissions.isAdmin(p)) { if (args[0].equalsIgnoreCase("edit")) { edit(); } } if (args[0].equalsIgnoreCase("claim")) { claim(); } ...
f0d2100d-6dcd-43e2-9ab5-9a79ab0a0b61
2
public void jugar(JFrame frame, EstadoVictoria escucharVictoria){ Point limitePueblo; //cambio dificultad System.out.println("dif min is " + this.defenseDiffMin + " and dif max is " + this.defenseDiffMax); System.out.println("Gold min is " + this.goldMin + " and gold ma...
b467c91f-3e61-45c0-b9e0-787533137270
7
public static Iterator fetchEdbQuery(Proposition proposition, LogicObject database, Stella_Object arguments) { RDBMS.checkForExternalDbUpdates(proposition, database); { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOI...
df6c8ded-d0bc-471b-acb8-8332fcd34976
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
bc265fbd-f03a-496a-b007-7b3ce0c90ba8
6
public GrooveJaar() throws FileNotFoundException, IOException, InterruptedException, ExecutionException { try { //CountryUtil.initCountryCode(); //JGroovex.initiateQueue(); JGroove.getToken(); } catch (IOException e) { showMessage("Fatal error.. Grooveshark.com seems to be down.."); e.printStackT...
25ce1e8e-9ed3-4aa4-a5bf-f8aa381d893c
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...
25050d0a-d9a6-481f-9e26-68cbc7719bed
6
public String authenticateUser(String userName, String password, boolean isAdmin) throws SQLException { String[] keys = {"userid", "username", "password"}; // qb = new QueryBuilder(); // Henter info om bruger fra database via querybuilder resultSet = qb.selectFrom(keys, "users").where("username", "=", userN...
b0134bb6-d8b9-4e40-9b12-4f5f26851f77
0
public static String get_stack(final Throwable t) { final PrintWriter pw = new PrintWriter(new StringWriter()); t.printStackTrace(pw); return pw.toString(); }
b2c8d5b2-0112-48cf-8034-a8391a66a102
0
public void setSkill2(SkillsMain skill22) { this.skill2 = skill22; }
a59796cc-8f3c-414d-bbb3-42df833f486b
1
public void run() { setupRobot(); while (true) { // Tell each component to act wheel.act(); radar.act(); gun.act(); targetSelector.act(); execute(); } }
b79c3c3b-ab42-4d41-b896-7d481262e369
1
@Override public byte[] save(JoeTree tree, DocumentInfo docInfo) { StringBuffer buf = prepareFile(tree, docInfo); try { return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); r...
d2f12ebf-86c6-44ac-bc48-6d9ad4073b40
4
public FileChooser(Forme forme) { super("./Ressources/Images"); this.setDialogTitle("Choisir une image"); this.setMultiSelectionEnabled(false); this.addChoosableFileFilter(filtre1); this.addChoosableFileFilter(filtre2); this.addChoosableFileFilter(filtre3); this.addChoosableFileFilter(filtre4); th...
46bfd8ce-eaad-4532-b56c-434d4369ddb3
8
public int computeChineseFields() { if (gregorianYear < 1901 || gregorianYear > 2100) return 1; int startYear = baseYear; int startMonth = baseMonth; int startDate = baseDate; chineseYear = baseChineseYear; chineseMonth = baseChineseMonth; chineseDate = baseChineseDate; // 第二个对应日,用以提高计算效率 // 公历2000...
ec6c5c4e-a565-4b17-bb59-61e17936128d
1
@Override public String toString() { if (minIteration != maxIteration) { return String.format("%d - %d", minIteration + 1, maxIteration + 1); } else { return new Integer(minIteration + 1).toString(); } }
8a2e4e60-d4ef-4a18-a5b4-f9729ab8405c
0
public static void main(String[] args) throws NumberFormatException, IOException{ int dividend = input("dividend"); int divisor = input("divisor"); output(division(dividend, divisor)); }
f38d8f53-cb7d-4df8-8138-8c8b5b989061
5
@Override public void sendUsageImpl(CommandSender sender) { if (!(sender instanceof Player)) return; sender.sendMessage(EdgeCore.usageColor + "/transfer <to> <amount> <description>"); User u = EdgeCoreAPI.userAPI().getUser(sender.getName()); if (u == null || !Level.canUse(u, Level.SUPPORTER)) return; ...
ea65c372-e8a5-4999-b1c8-155ddc5323d8
8
public static ArrayList<Improvement> getValidImprovements(Civilization civ, BaseEntity en) { ArrayList<Improvement> temp = new ArrayList<Improvement>(); /*for (Entry<String, Improvement> entry: unitImprovementMap.entrySet()) { String name = entry.getKey(); Improvement i = entry.getValue(); //Split into ...
1a1eb58e-8c5e-4732-80d0-53b940c982e5
8
public <T> T httpRequest(HttpMethod method, Class<T> cls, Map<String, Object> params, Object data, String... segments) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setAccept(Collections .singletonList(MediaType.APPLICATION_JSON)); if (accessToken !...
adb058e0-ab92-4374-9ade-d2f742a69b52
0
private void drawGUI() { setResizable(false); setTitle("Email-Management"); setIconImage(Toolkit.getDefaultToolkit().getImage(iconPath)); addWindowListener(new WindowAdapter(this)); setBounds(100, 100, 331, 229); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnKontakt = new JMenu("Ko...
a9d7f46a-5503-4502-9e24-89d20fbf1eb9
2
@Override public int compareTo(Bill o) { if (this.date.before(o.getDate())) { return -1; } else if (this.date.after(o.getDate())) { return 1; } else return 0; }
c95f844b-8d11-4003-af28-5601c6417da7
9
@Override public void update() { int speed = 6; if (world.getCollidingEntities(this).size() == 0 && !inAnimation) { move(0, speed); } if (world.getRacket().collidesWith(this)) { inAnimation = true; Game game = world.getGame(); game.g...
492669cc-670d-4cff-8f1d-a17484256226
3
public void loadStats() { if(plugin.configData.trackStats) { this.stats = new HashMap<String, Stat>(); this.globalSpins = 0; this.globalWon = 0.0; this.globalLost = 0.0; Integer i = 0; if(plugin.configData.stats.isConfigurationSection("types")) { Set<String> types = plugin.configD...
7f4f3814-002e-4388-be61-2bcff0adc5c8
4
@Override public void run(CommandArgs arg0) { String[] args = arg0.getRawArgs().split(" "); if (args.length > 1 && args[0].equals("site")) { Integer id = Integer.parseInt(args[1]); Site site = WebServer.getSiteByID(id); if (site == null) { Syst...
b80f06e4-2ef1-4044-aedd-7076175a6066
4
private static <T extends Comparable<? super T>> T median3( T[] a, int left, int right) { int center = (left + right) / 2; if (a[center].compareTo(a[left]) < 0) swapReferences(a, left, center); if (a[right].compareTo(a[left]) < 0) swapReferences(a, left, right); if (a[right].compareTo(a[center]) < 0) ...
c8e501c9-057a-4052-aed0-251c5c1e3cb5
2
public static <T extends DC> Set<T> dom(Set<Pair<T,T>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().fst(),dom(phiMax.getNext())); } else { return new Set(phiMax.getFst().fst(),null); } } else { return null; } }
8cb250c1-dcfc-4c8e-98ad-0baffee7ddc5
8
public void steal() { synchronized (_cards) { boolean[] found = new boolean[ins.length]; for (int i=0;i<ins.length;i++) found[i] = false; ArrayList<Card> torm = new ArrayList<Card>(); for (Card c : _cards) { for (int i=0;i<ins.length;i++) { if (c.mytype == ins[i] &...
d5cc6d66-7c4e-4b52-94e9-bbb258301719
5
void checkSignature(Class<?>... signatur) { Class<?>[] parameters = method.getParameterTypes(); RuntimeException ex = new RuntimeException("Method " + method.getName() + " must have the following signature: " + Arrays.toString(signatur)); if(parameters.length != signatur.length) throw ex; for(int i...
285019ab-4b79-403f-9dfb-fe34aea89353
2
@Override public void mouseReleased(MouseEvent e) { Rectangle rect = new Rectangle(e.getX(), e.getY(), 1, 1); Barrillo[] prebarrillo = barrillos.toArray(new Barrillo[0]); Barrillo barrilloAExplotar = null; for (Barrillo bar : prebarrillo) { if (bar.devolverRectangle().int...
1086b3a6-1aa2-4d7e-9901-3585b47e98de
9
@Override public SXLValue castInto(String type) throws Exception { switch( type ) { case "string": return new SXLString( (value)? "true" : "false" ); case "boolean": return new SXLBoolean( value ); case "integer": return new SXLInteger( (value)? 1 : 0 ); case "real" : return new SXLReal( (value)? 1.0 : 0...
44772b1d-dc3c-4447-8ec4-903cc626ad85
3
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); if (context.containsBean("quarantinedDataSource")) { LOG.info("Using quarantinedDataSource"); } else { LOG.info("Using normal dataSource"); } EventService service = context.getBean(E...
b4282df5-74bd-448e-bfc0-4d6c3a33dc72
3
public Population elitism(Population pop, int outSize){//cut percent (rather than number) Individual [] subset = new Individual[outSize]; //sort by fitness Comparator<Individual> indComp = new Comparator<Individual>() { @Override public int compare(Individual a, Individual b) { double ...
1e3320bb-3e2f-40b3-8816-d232da2ace3f
3
public JsonObjectBuilder rewriteJson(JsonObjectBuilder copyInto,JsonValue tree,String key){ /** * Helper function used to parse json */ switch(tree.getValueType()){ case OBJECT: JsonObject obj = (JsonObject) tree; for(String name : obj.keySet()){ copyInto = rewriteJson(copyInto,obj.get(name),name)...
1f3d52c5-29eb-4fd3-981d-e3ddbc4fde5b
6
private long highestPrimeFactor(long number){ if (isPrime(number)){ return number; } long factor = 2; long highestPrimeFactor = 1; while (factor <= number/factor){ if ((number%factor==0) && isPrime(factor)){ if (factor > highestPrimeFactor){ if (isPrime(number/factor)){ factor = ...
9062f763-bd0d-4661-945c-f39449fcf861
1
@Override public double observe() { double observed = 0; for (int i = 0; i < r; i++) { observed += geom.observe(); } return observed; }
111fc68d-3c10-4924-a911-1bfeaf987541
1
public void pop() { Menu menu = getCurrentMenu(); if (menu != null) { menu.setMenuStack(null); menuStack.pop(); } }
69166c7f-0220-4916-be14-e9e7c3dec7c1
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; boolean success=proficienc...
c5ed6638-30b5-4128-95f8-3b25bfe01bc5
1
public String toString() { String result = board.toString(); if (isGameOver()) result +="\n\n Game over"; return result; }
396fa08b-712a-4756-a2d2-aaedff04e81e
0
private PNGHelper() { }
a3113930-c85f-4f82-b70e-1e89db632e3e
1
@Override public Position<T> left(Position<T> p) throws BoundaryViolationException, InvalidPositionException { BTPosition<T> rp = checkPosition(p); Position<T> leftP = rp.getLeft(); if (leftP == null) throw new BoundaryViolationException("No left child"); return leftP; }
8b4f70ae-6c5b-4379-b331-b0bae3a4a9b4
3
private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed if(evt.getKeyCode() == evt.VK_F1){ btnovo(); } if(evt.getKeyCode() == evt.VK_F2){ btAlterar(); } if(evt.getKeyCode() == evt.VK_F3){...
4a9a2ccf-c466-4229-b895-c8de5fbaa035
8
private void scan() { if (updateList) { for (int i = 0; i < numberOfAtoms - 1; i++) { for (int j = i + 1; j < numberOfAtoms; j++) { xij = atom[i].rx - atom[j].rx; yij = atom[i].ry - atom[j].ry; rij = xij * xij + yij * yij; bondLength = getBondLength(atom[i], atom[j]); if (rij <= bond...
7fafe3d4-183e-443c-83ab-7846043200cb
3
private String peekUrl(String filename){ String firstUrl = ""; try{ int i = 0; BufferedReader in = new BufferedReader(new FileReader(filename)); String tmpFileName = filename + ".tmp"; BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFileName)); String line = ""; while((line = in.readLine(...
ea7017b2-12d8-4e22-a78c-ebbd2b4fc503
4
final int memberValue(int pos) throws Exception { int tag = info[pos] & 0xff; if (tag == 'e') { int typeNameIndex = ByteArray.readU16bit(info, pos + 1); int constNameIndex = ByteArray.readU16bit(info, pos + 3); enumMemberValue(typeNameIndex, constN...
6d8aa8e6-c969-4c22-983e-c3cae97a58cd
7
@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(mob.getWorshipCharID().length()==0) { mob.tell(L("You must worship a god for this prayer to work."));...
b82c5694-0cdb-420b-b806-301e059c16b5
5
public OOXMLChart( Chart c, WorkBookHandle wbh ) { // Walk up the superclass hierarchy //System.out.println("BEFORE: chartArr: " + Arrays.toString(chartArr.toArray())); for( Class obj = c.getClass(); !obj.equals( Object.class ); obj = obj.getSuperclass() ) { java.lang.reflect.Field[] fields = obj.getDecla...
45c8afde-662a-47b2-b58e-f5b56f5ebced
8
public Set<Map.Entry<Integer,Float>> entrySet() { return new AbstractSet<Map.Entry<Integer,Float>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TIntFloatMapDecorator.this.isEmpty(); } ...
3f36cc5e-3774-429b-8eb1-0f5085560cc2
4
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!plugin.hasPerm(sender, "weather", true)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } Player player = (Player) sender; World world = player.get...
c642e657-0783-45e8-8353-3d1eefb22bb0
0
public TrieNode getAdj(char ch){ return adj[getIndex(ch)]; }
04911ac7-9d61-4aa5-91f4-ce7a113c10ae
4
private Object handleFile(Object tos, String tagName) { if (tos instanceof Header && ((Header)tos).getFile() == null) { return new FieldRef(tos, "File"); } else if (tos instanceof Media && ((Media)tos).getFile() == null) { ((Media)tos).setFileTag(tagName); return new FieldRe...
247f3648-1240-4d44-a80e-96096ff17483
8
public void initGraph(String path){ BufferedReader file ; String line; String name, id; int y = 0; try { file = new BufferedReader(new FileReader(path)) ; while ((line = file.readLine()) != null) ...
6d987928-cdba-4621-a660-1398b0d62e38
9
public static void main(String[] args){ //check that the minimum number of command line arguments were entered if(args.length<5){ System.out.println("attack, decay, sustain amp, sustain time, release"); System.out.println("Optional: Num_of_file, names of files"); System.exit(1); } ...
6b14ac8f-61d0-45f5-a6bd-f257b91db5db
8
@Override public Model getRotatedModel() { Model model = spotAnimation.getModel(); if (model == null) { return null; } int j = spotAnimation.sequence.frames[anInt1569]; Model model_1 = new Model(true, Animation.isNullFrame(j), false, model); if (!aBoolean1567) { model_1.skin(); model_1.transform(j...
4dbf7023-9d09-4bc9-8947-79014c3409ed
9
public static void main(String[] args) { try { Experiment exp = null; // get options from XML? String xmlOption = Utils.getOption("xml", args); if (!xmlOption.equals("")) args = new XMLOptions(xmlOption).toArray(); String expFile = Utils.getOption('l', args); Str...
a500c561-e6b1-485d-95b0-197c1218d79a
7
public static FieldType convertToXMLFieldType(FieldState state) { switch (state) { case EMPTY: return FieldType.EMPTY; case WALL: return FieldType.WALL; case DIAMOND: return FieldType.DIAMOND; case PLAYER: ...
49e02649-c4de-4f29-ba7c-934b70a10a71
0
public int getX(){ return x; }
5a870648-b48d-4293-8e29-f63253d25a1b
9
private void runTest(File path) { mOutput = 0; System.out.println(path.toString()); try { LarkScript script = new LarkScript(path.getPath()); mPassed = true; // parse the script to get the expected behavior ...
9e2e443c-cf71-4536-abaa-cab3e8b61649
5
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (singleButton.getSelection ()) style |= SWT.SINGLE; if (multiButton.getSelection ()) style |= SWT.MULTI; if (horizontalButton.getSelection ()) style |= SWT.H_SCROLL; if (verticalButton.getSelection ()) style |...
a24320d7-97a7-4a5d-a832-296b78cb131b
1
public T arbitrary(Random random,long size) { if (random.nextDouble() < probability) { return null; } else { return generator.arbitrary(random, size); } }
91ec0cef-1b61-4d19-970f-6fb1f1194168
0
public String getProtocol() { return this.protocol; }
ea1ecbef-f804-41c2-93ac-5f1cda5f1c12
6
public void mouseReleased(MouseEvent event) { transitionInFlux = false; if (event.isPopupTrigger()) showPopup(event); State[] states = getView().getDrawer().getAutomaton().getStates(); int count = 0; for(int k = 0; k < states.length; k++){ if(states[k].isSelected()){ count++; } ...
ca5eb5a5-0576-444c-9efd-9a57fa1a3bb7
0
public void setFunConsumoUltimoMes(Integer funConsumoUltimoMes) { this.funConsumoUltimoMes = funConsumoUltimoMes; }
a041b557-172d-4644-b1e9-9dcce36cba09
2
public void insertDisc(int col, CellState player) { if (!isFull(col)) { // XXX getrowdepth in tmp_var speichern damit nicht 2x aufrufen? model.setCell(col, getRowDepth(col), player); this.isWinning(player, col, getRowDepth(col)); } if (isFull()) { EventSystem.getInstance().queueEvent(new GameStatusUp...
2853b046-fd92-441f-aa7f-404107adfe97
5
public int hgetbits(int N) { totbit += N; int val = 0; int pos = buf_byte_idx; if (pos+N < BUFSIZE) { while (N-- > 0) { val <<= 1; val |= ((buf[pos++]!=0) ? 1 : 0); } } else { while (N-- > 0) { val <<= 1; val |= ((buf[pos]!=0) ? 1 : 0); pos = (pos+1) & BU...
3084ed0f-9de8-4d80-863b-fe70787e11fa
4
public static void main(String[] args) { ArrayList<Product> products = new ArrayList<>(); try { BufferedReader fileReader = new BufferedReader(new FileReader("D:\\Soft\\JAVA\\LoopsMethodsClasses\\src\\ListInput.txt"));; File fileProducts = new File("D:\\Soft\\JAVA\\LoopsMethodsClasses\\src\\ListOutput.txt...
b7e551a4-1b43-4adc-8e61-bc955c288ed0
5
public static void call(final String mapping, final String data) throws Exception { // delimited by a comma // text qualified by double quotes // ignore first record final Parser pzparser = DefaultParserFactory.getInstance().newDelimitedParser(new File(mapping), new File(data), ',', '"',...
00d3ad94-ea46-478b-a5b5-ea460cb0d912
5
public void saveToFile (String fileName) { ZipOutputStream zipOut = null; // create new ZIP file try { zipOut = new ZipOutputStream(new FileOutputStream(fileName)); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return; } // enabl...
8fa095e0-3def-45a6-82ef-b55dc1f793b5
2
public void visitSwitchStmt(final SwitchStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } stmt.visitChildren(this); genPostponed(stmt); final Label[] targets = new Label[stmt.targets().length]; for (int i = 0; i < targets.length; i++) { targets[i] = stmt.targets()[i...
592fda2d-a289-49dd-99cb-f89e454b50bd
4
public static String MD5(String plainText) { StringBuffer buf = new StringBuffer(""); try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) ...
5b84c6da-fcb1-4669-af4f-11f3c939fc63
5
public void verify() throws MVDException { SimpleQueue<Node> queue = new SimpleQueue<Node>(); HashSet<Node> printed = new HashSet<Node>(); start.verify(); queue.add( start ); while ( !queue.isEmpty() ) { Node node = queue.poll(); node.verify(); ListIterator<Arc> iter = node.outgoingArcs(this); ...
72c087bb-2e7f-4a9b-b4cf-3456c590ccda
1
public void moveRight() { if (ducked == false) { speedX = MOVESPEED; } }
af9d792a-43f0-4eee-bfd7-6b6f6d947888
7
OlogProperties(){ preferences = Preferences.userNodeForPackage(OlogClient.class); try { File userCFPropertiesFile = new File(System.getProperty( "olog.properties", "")); File userHomeCFPropertiesFile = new File(System .getProperty("user.home") + "/olog.properties"); File systemCFProperti...
4f4424cb-7b77-47ed-8e13-a31b92db69f7
8
@Override protected void setAttrs(User model, PreparedStatement stmt) throws SQLException { { stmt.setString(1, model.getHandle()); } if (model.getCreatedAtMillis() == null) { stmt.setNull(2, java.sql.Types.INTEGER); } else { stmt.setLong(2, model.getCreatedAtMillis()); } { ...
cdb4a704-c80c-454e-b68c-349d1e58c786
4
public static String quote(String in) { StringBuilder buf = new StringBuilder(); for(int i = 0; i < in.length(); i++) { char c = in.charAt(i); if((c == '$') || (c == '{') || (c == '}')) { buf.append('$'); buf.append(c); } else { buf.append(c); } } return(buf.toString()); }