method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c97616fa-6e7f-43c4-9aa7-4465ca70125e
5
public void allocatePoints(Contestant c) { Iterator<User> itr = allUsers.iterator(); User u; while (itr.hasNext()) { u = itr.next(); if (u.getWeeklyPick().equals(c)) { if (this.isFinalWeek()) // final week u.addPoints(40); else // normal week u.addPoints(20); } // if the end of...
83e2816c-020f-4e7b-b32b-fb3c2f6f2141
4
public UpdateQuery in(String... args) { if (args.length == 1) { for (String arg : args) { if (arg.startsWith("(")) { // nested select query.append(" IN ").append(arg); } else { // just single value, same as below query.append(" ...
14306580-ca14-4a20-a3ac-43bd2acdec67
6
public ArrayList<Node> generateBridgedER(int n1,int n2, double p1, double p2, int b){ ArrayList<Node> c1 = generateConnectedER(n1,p1); ArrayList<Node> c2 = generateConnectedER(n2,p2); for(int i= 0;i<n2;i++) { c2.get(i).resetID(i+n1); } ArrayList<Node> nodes = ...
cc56d512-d73a-4673-83e5-915b8177d2d8
8
protected void calculateCutPointsByEqualWidthBinning(int index) { // Scan for max and min values double max = 0, min = 1, currentVal; Instance currentInstance; for(int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isM...
12c152fe-abd6-483d-8ae3-900a84751124
8
public static void main(String[] args) throws IOException { String name = null,str = null; int size = BUFSIZE,bufferSize = BUFSIZE; for(int i = 0;i < args.length;i++){ switch(args[i]){ case "-s": size = Integer.valueOf(args[++i]).intValue(); break; case "-b": bufferSize = Integer.valueOf(arg...
c1e99f5a-8c88-4a4c-a23c-85e39ff87c83
6
public void addChromosome(Chromosome chrom) throws Exception { if (chrom==null) { throw new Exception("Error in addChromosome: chrom==null"); } if ((ploidy==2 && chrom.getClass().equals(TetraploidChromosome.class)) || (ploidy>2 && !chrom.getClass().equals(TetraploidChromo...
9428834c-311a-4c13-ba24-d3620ab91a87
9
static public Var isMacro(Object op) throws Exception{ //no local macros for now if(op instanceof Symbol && referenceLocal((Symbol) op) != null) return null; if(op instanceof Symbol || op instanceof Var) { Var v = (op instanceof Var) ? (Var) op : lookupVar((Symbol) op, false); if(v != null && v.isMacro()) ...
65823047-8f46-4fe3-8d6e-afc7afaea2b2
3
public void enter(String sqlstatement, int type){ try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); switch (type) { case QUERY: ResultS...
d430e822-d51c-4519-9815-27a6d8675081
0
@Override public void removeProperty(String key) { this.default_values.remove(key); this.current_values.remove(key); this.filter_chains.remove(key); }
2c15f3a5-daea-45de-9d2d-d1402b8ece73
5
private static int isKingKong(ArrayList<Card> list) { assert(list.size() == EFFECTIVE_CARD_NUM); int change = 0; int changePos = 0; for ( int i = 1; i < 5; i++ ){ if (list.get(i).getPoint() != list.get(i - 1).getPoint()){ change++; changePos = i; if ( change > 1 || (changePos != 1 && change...
f3c9ba44-b315-49fe-93d8-53d4af6236b5
7
public static ComplexNumber parseComplex(String s) { s = s.replaceAll(" ",""); ComplexNumber parsed = null; if(s.contains(String.valueOf("+")) || (s.contains(String.valueOf("-")) && s.lastIndexOf('-') > 0)) { String re = ""; String im = ""; s = s.replaceAll("i",""); s = s.replaceAll("I",""); if(...
d5e6ee43-e442-416a-97ee-27ce488eea0f
7
private void removeFullLines(){ int numFullLines = 0; for (int i = BoardHeight - 1; i >= 0; --i) { boolean lineIsFull = true; for (int j = 0; j < BoardWidth; ++j) { if (shapeAt(j, i) == Tetrominoes.NoShape) { lineIsFull = false; ...
ac16f24b-2229-4a27-8198-296eeb600bfa
4
@Override public void run() { while (!SH.get(tcn).isInterrupted()){ try { String rtn=Tclient(tcn); if (rtn.equals("reload")){ TNH.get(tcn).loggedin=0; SH.get(tcn).interrupt(); TNH.get(tcn).killme(); } } catch (SocketException e) { dw.append("Server "+tcn+" offline."); ...
6e68bdde-ed3a-4ff0-af37-19cb00d28ac7
8
public Instance cleanse(Instance before) throws Exception{ Instances insts = before.relationalValue(1).stringFreeStructure(); Instance after = new DenseInstance(before.numAttributes()); after.setDataset(m_Attributes); for(int g=0; g < before.relationalValue(1).numInstances(); g++){ Instance datu...
70a65dff-0a76-4a0f-93f4-7096ef084121
2
public TextBox(String text, boolean fill) { parseText(text); if(fill) { addTimeListener(new TimeListener() { public void timeStep(TimeEvent e) { textFill += e.getDelta() * fillSpeed; if(textFill >= TextBox.this.getLength()) { TextBox.this.removeTimeListener(this); } } });...
1359f425-0b0a-4a27-b0a7-d8e75710747c
5
@EventHandler public void onPlayerSpin(final PlayerInteractEvent event) { final Block block = event.getClickedBlock(); if(block == null) return; if(FancyRoulette.instance.tableManager.isBlockSpinner(block)) { if(! event.getPlayer().hasPermission("roulette.spin")) { event.getPlayer().sendMessage(ChatCol...
81d27c1a-fcb5-41a4-85e6-251ffdfe9d51
1
private void updateLabels(int dummy) { labelGold.setText(sliderGold.value()+"/"+player.getResource(core.ResourceType.GOLD)); labelWood.setText(sliderWood.value()+"/"+player.getResource(core.ResourceType.WOOD)); labelOre.setText(sliderOre.value()+"/"+player.getResource(core.ResourceType.ORE)); try { amount =...
d349523b-eca5-4203-b0c9-63953dc9c1cd
6
public Object result() { if (Protocol.Type.STRING == type) { return StringUtils.toString(current, charset); } else if (Protocol.Type.ERROR == type) { return new RedisException(StringUtils.toString(current, charset)); } else if (Protocol.Type.INTEGER == type) { return NumberUtils.toInt(StringUtils.toStrin...
b99c1a15-b8be-4db8-bbde-360cfa00a2f8
1
public Item peek() { if (isEmpty()) throw new NoSuchElementException("Queue underflow"); return first.item; }
6c4313ad-758e-4cee-918a-3700a72e81be
0
public MooreStateTool(AutomatonPane view, AutomatonDrawer drawer) { super(view, drawer); }
4d52883a-7f27-4eab-8ffa-84212a8fa346
2
public void setRollValue(int rollValue) { if(rollValue > 1 && rollValue < 13) { this.rollValue = rollValue; } else { //throw exception } }
19a9e4fb-4ee8-4943-85bf-4a8f7af83918
3
private void printToFile(List<Citation> citations) { File newFile; while (true) { String filename = io.getString("Name the new BibTex file (.bib is added automatically): "); newFile = new File(filename + ".bib"); if (newFile.exists()) { io.println("A ...
c82f4ce3-0636-4e37-be67-0c78fabb7abf
7
@Test public void testFunctionality() { GameConfiguration origConf = new GameConfiguration(); origConf.setAgentCount(1); origConf.setFoodAmountIncrese(2); origConf.setHiddenLayers(3); origConf.setInitialFoodAmount(4); origConf.setMutate(true); origConf.setMutationAmount(5); origConf.setMutationProb(0.3...
6fcfc026-7756-4698-baeb-f6d7a65c3c86
0
@Override public void method2() { }
c5ab527e-0f51-4d96-a285-b3ef26dbfb9a
4
public void getTipitPrice(final int... ids) { try { for(int id : ids) { String price; final URL url = new URL("http://www.tip.it/runescape/json/ge_single_item?item=" + id); final URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS ...
ccf6465a-9353-4bb1-9e12-aec304b8c80b
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Artist that = (Artist) o; if (idArtist != that.idArtist) return false; if (description != null ? !description.equals(that.description) : that.d...
5f7876ef-9c69-43dc-b37d-1c5740194f95
1
public boolean estDisponible(){ if(this.situation == DISPONIBLE){ return true ; } else { return false ; } }
8c8ff877-8787-484a-96cb-b421fc95c9fc
3
private String col(String s, int width) { if(s == null) s = ""; if(s.length() >= width) s = s.substring(0, width - 1); while(s.length() < width) s = s + " "; return s; }
8b13d38a-0837-45b6-a7d0-f548c8d0a3c9
9
public boolean isOver() { boolean over = false; if (bLastMove == null || rLastMove == null) { over = false; } else if (this.bLastMove.isPass() && this.rLastMove.isPass()) { over = true; } else { boolean neutral = false; for (int row = 0; row < 5; row++) { for (int col = 0; col < 5; col++) { ...
a9ca121a-05cf-454d-b1cb-dc61389a085d
2
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String leave = request.getParameter("user"); System.out.println("Bye " + leave); UsersSingleton users = UsersSingleton.getInstance(); ArrayList <User> ...
13f1d9a0-0fbe-4675-bc58-0dcd532697c9
8
public static void main(String[] args) { Scanner scn = new Scanner(System.in); int v = scn.nextInt(); int e = scn.nextInt(); while (v != 0 || e != 0) { // Initialize no incoming set TreeSet<Integer> noIncoming = new TreeSet<Integer>(); for (int i = 1; i <= v; i++) { noIncoming....
a5aa5ff3-ff8e-4530-8c11-43a74ea623d4
5
public Production[] getItemSet(Set items, String message) { restricted = items; choiceTable.setModel(new ImmutableGrammarTableModel()); alreadyChosen = new HashSet(); while (true) { int choice = JOptionPane.showConfirmDialog(parent, panel, message, JOptionPane.OK_CANCEL_OPTION); if (choice == JOption...
f846e4a5-b0bd-4a3e-86e1-66be2894bbb8
8
public BeanSerializer (Kryo kryo, Class type) { this.kryo = kryo; BeanInfo info; try { info = Introspector.getBeanInfo(type); } catch (IntrospectionException ex) { throw new KryoException("Error getting bean info.", ex); } // Methods are sorted by alpha so the order of the data is known. PropertyDe...
363c013b-8190-4f07-ba82-0f1659e09fee
2
public Line FindClosestEdge(Vector2 v) { double min = v.getDistance(new Vector2((edges[0].x0 + edges[0].x1) / 2, edges[0].y0)); int id = 0; for (int i = 1; i < 4; i++) { double d = v.getDistance(new Vector2((edges[i].x0 + edges[i].x1) / 2, (edges[i].y0 + edges[i].y1) / 2)); if (d < min) { min = d;...
57e0c7f3-2c06-451f-a807-f14844bd2e1a
5
@Override public int backlog(double e, double s, double c) { double L = e + s + c; double n = s + 2*c; double next = 0; double previous = -1; while(previous < next) { double p1 = Math.pow(1 - (e/L), n); double p2 = Math.pow((L-e-s) / (L-e), (n-s)); for(int i = 0; i < s; i++) { ...
bcebc7bc-1dee-4325-a8f1-3d67a91a0cd3
7
static void EscribirCacheAsociativa(int i, int v) { int Etiqueta = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(0, 9)); int Palabra = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(9, 12), 2); int Linea = leastRecentlyUsed.consult(Integer...
894e59b7-bc88-47f9-ae06-bbbbc842f0c7
9
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { bowlSize=sumOfArray(bowl); if (musTake || !canPick) { modifyDistribution(bowl); roundInit(1); return true; } double expectedScore=getExpectedScore...
8b9acfdc-0fb9-44df-a8bc-0893cb5aee42
4
public Boolean process() { // Permissions if(!plugin.permission.canCreate(player)) { noPermission(); return true; } // Correct command format if(args.length == 2) { // Slot exists if(plugin.slotData.isSlot(args[1])) { SlotMachine slot = plugin.slotData.getSlot(args[1]); // C...
05036315-c2a7-43c9-b61e-1e71b1ed6d0e
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Listing other = (Listing) obj; if (!Objects.equals(this.value, other.value)) { return false; ...
412f066f-bc76-4505-8612-5b7669af71ab
6
private void loadGameObjectType(IGameObjectType type) { if (!gameObjectTypeCache.containsKey(type)) { try { // type was not loaded yet -> load it Ini iniFile = new Ini(this.getClass().getResource("/" + type.getIniFilePath())); Section section = iniFile.get(type.getIniFileSection()); if (section !=...
49cd4e1f-01ab-4c1f-9e2b-76bf6ac91a42
3
private Box nextEmptyBox(char[][] board, int row, int column) { int i = row; int j = column; for (; i < 9; i++) { for (; j < 9; j++) { if (board[i][j] == '.') return new Box(i, j); } j = 0; } return done; ...
d5c7e783-a814-4243-91f2-6b16fae3dc92
3
public Integer getTotalCoffers(Player player){ if(player==null) return null; Integer total = 0; Iterator<OfflinePlayer> itr = coffers.values().iterator(); while(itr.hasNext()){ if(itr.next().equals(player)) total++; } return total; }
56c809ac-b7a2-45a2-af2a-76c1b37017fe
7
public boolean containsAll(AbstractOrderedItemset itemset2){ // first we check the size if(size() < itemset2.size()){ return false; } // we will use this variable to remember where we are in this itemset int i = 0; // for each item in itemset2, we will try to find it in this itemset for(int j =0;...
a372802b-e825-43bc-b72e-2d052bc01aa9
3
public static <T extends DC> Equality getPhiEqu(Set<Pair<T,T>> done) { if(done!=null) { if(done.next!=null) { return new Equality(done.a.fst().delta(done.a.snd()).equa().getValue()&&getPhiEqu(done.next).getValue()); } else { return new Equality(done.a.fst().delta(done.a.snd()).equa().getVa...
226ecdc9-b30d-4d39-9fef-8196406d617b
6
private void doUpdateTrafficMask() { if (trafficControllingSessions.isEmpty()) return; for (;;) { DatagramSessionImpl session = trafficControllingSessions.poll(); if (session == null) break; SelectionKey key = session.getSelectionKey(); ...
eec78dcb-ce56-4770-9ab8-499473ca0a56
1
public void run() { ThreadLocalRandom random = ThreadLocalRandom.current(); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } bank.transfer(accounts[random.nextInt(0, ACC...
f52be68e-306c-444c-b030-a2c539a5e7e5
8
public double getEstimatedUtilityForDarkPlayer(CheckersSetup setup, boolean isDarkTurn) { ArrayList<checkersSetup.Turn> turns = BasicCheckersAIFunctions.getAllPossiblePlayerOptionsFor1Turn(setup, isDarkTurn); if(turns.size() == 0) { if(isDarkTurn) { return -BasicCheckersAIFunctions.DARK_WIN_UTILITY; } els...
1d9fd4de-5924-48c4-b850-f33df7cc34cb
6
@Test public void cevTest1() { userInput.add("hi"); userInput.add("my name is meng meng"); userInput.add("cavideria"); userInput.add("cavideria"); userInput.add("cavideria"); userInput.add("cavideria"); userInput.add("yes"); this.runMainActivityWithTestInput(userInput); assertTrue((nlgResults.g...
5b6d5d5f-a380-451e-abda-7966adcf9390
2
public void update(GameContainer gc, int delta) throws SlickException{ super.update(gc, delta); move(gc.getInput()); executeStatusEffects(delta); dt += delta; if(dt > 1000) { dt = 0; float edx = enemy.dx; float edy = enemy.dy; float a = (edx * edx) + (edy * edy) - 25; float b = ((enemy.x...
9a2e3b90-0c9c-4480-8508-5f830c0a8cfa
3
protected void removeAnimal(Animal animal) { for (int i = 0; i < grid.length; i++) { for (int j = 0; i < grid[0].length; j++) { if(grid[i][j].equals(animal)) { grid[i][j] = null; return; } } } }
49f42e54-5a9b-4a07-932d-d731b409e55f
9
private boolean removeAllOnes() { boolean happened = false; for (final HashSet<MathsItem> hs : items) { if (hs.size() < 2) continue; final HashSet<MathsItem> toremove = new HashSet<MathsItem>(); for (final MathsItem m : hs) if (m.isOne()) toremove.add(m); if (toremove.si...
05b546fd-a562-4cf7-a567-e157507f79b1
4
public void initHauptmenue() { clearContent(); loadFont(); spielNeu = new JButton("Neues Spiel"); spielNeu.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { initGame(); } } }); spielNeu.setFont(gothic); ...
431b148d-0999-40ca-97e2-16a2b385ad6f
9
protected void rootStored( File f, StoreResult sr ) { if( sr.storedObjectCount > 0 && sr.fileInfo != null ) { String message = LogUtil.formatStorageLogEntry(new Date(), sr.fileInfo.getFsObjectType(), sr.fileInfo.getPath(), sr.fileInfo.getUrn()); try { FileOutputStream log = getIncomingLogStream(); log.w...
5743a1d7-677b-43bb-a619-f2a1ca047766
5
public String grailFormat(){ String output = "Grail Transitions:\n"; for(State s: startStates){ output += "(START) |- "+s.getName()+"\n"; } for(State s: states){ for(String symbol: alphabet){ output += s.getName() + " " + symbol + " "; for(State q: s.transition(symbol)) output += q.getName();...
ae44335e-0684-4e0b-8b69-8910d9215d76
9
public MemoryFrame(java.awt.Frame parent, final DCPU dcpu) { super(parent, false); initComponents(); this.ramTable.setModel(new DCPUMemoryTableModel(dcpu)); //disallow selection of column 0 this.ramTable.getColumnModel().setSelectionModel(new DefaultListSelectionModel() ...
d9537473-2ab9-4c33-9a7d-bdd87f11253f
3
@Override public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof InjectablePlugin)) { return false; } return getName().e...
7121a061-06ba-410e-80bb-906ffed63ab4
4
public SQLconnection conn() { SQLconnection sql=new SQLconnection("127.0.0.1", "root", "anika", "dblp"); try { sql.connectMySql(); } catch (InstantiationException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackT...
590105e8-3229-4c0c-8e6e-b6a45e8c1025
0
public String getCategoryName() { return categoryName; }
279594b4-d67d-4d5b-8fe9-7b2784950023
8
public Widget find(int x, int y) { Widget found = null; // to augment height int extraSpaceBetweenLines = 0; if(numLines > 1){ extraSpaceBetweenLines = numLines - 1; } if (x >= this.x && x < this.x + W && y >= this.y && y < this.y + H * numLine...
7964dd6d-2987-46af-b952-a482daf673a5
0
public static long differHowManyDays(Date arg0, Date arg1) { long d1 = arg0.getTime(); long d2 = arg1.getTime(); return Math.abs(d1 - d2) / (60 * 60 * 24 * 1000); }
3a321d46-3f5a-4325-a3f1-ae9100e33ef9
1
public void addListener(OutlineModelListener listener) { if (!mListeners.contains(listener)) { mListeners.add(listener); } }
1d8169d7-6663-4862-bed7-11895ad5d361
4
public static void saveChannels() { File channelFolder = new File(System.getProperty("user.dir") + "\\channels"); File channelList = new File(channelFolder.getAbsolutePath() + "\\channels.txt"); if(categories.isEmpty()) { channelList.delete(); } try { File...
3926df50-0e15-4a77-91a6-e1aacd88de5e
4
static void testRange(int first, int last) { print("Testing range from " + first + " to last " + last + "."); long start = 0,end = 0; Range range = new Range(first,last); long normalDuration = 0; long rangeDuration = 0; long waste = 0; start = System.nanoTime(); for (int curr = first; curr <= last...
e81ba6c0-b6a4-4641-b233-a678c8e68919
4
private float calculatePositionValue(PositionType type, ROVector3f target, Coordinate currentCoordinate, Coordinate coordinate) { float position = filterPosition(target, type); boolean isInSameSystem = currentCoordinate.equals(coordinate); if (hasParent() && !isInSameSystem) { float parentValue = fil...
d8301216-9f71-4fd6-8d05-5448260cbc1d
0
private ContentManager(){ this.blockManager = new BlockManager() ; this.packetManager = new PacketManager(); }
81ac3855-2951-4f80-a2e9-4e1092dd74f3
3
public static void main(String[] args) { long start = System.nanoTime(); int sum = 0; for (Integer i = 1; i < 1000000; i++) { BigInteger binaryVal = new BigInteger((Integer.toBinaryString(i))); if (isPalindromic(BigInteger.valueOf(i)) && isPalindromic(binaryVal)) { sum += i; } } System.out.p...
cc217fb7-4642-4f91-87cd-817c7e8d143f
0
private CollectionPerson() { Persons = new ArrayList<Person>(); CantPerson = 0; }
933b78ec-5204-4d80-b801-2daf86680f6e
4
private static ByteBuffer toByteBuffer(byte[] data, boolean isStereo, boolean isBigEndian) { ByteBuffer dest = ByteBuffer.allocateDirect(data.length); dest.order(ByteOrder.nativeOrder()); ByteBuffer src = ByteBuffer.wrap(data); src.order(isBigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN); if (is...
9c4a7a60-704d-4db2-93b3-27ad03953ae5
3
@SuppressWarnings("unchecked") public E pop() { if (empty) return null; E ret = (E)VALUES[begin]; VALUES[begin] = null; begin++; if (begin==MAX) begin=0; if(begin == end){ empty = true; begin = end = 0; } return ret; }
26528c86-c541-4f1c-9bc4-134751308637
9
@Override public boolean installPackage(String path) { boolean result = false; do { long now = System.currentTimeMillis(); File tmp = new File(TMPPRE + now); if(!tmp.exists()) { tmp.mkdirs(); } String tmpPath; try { tmpPath = tmp.getCanonicalPath(); } catch (IOException e1) { e1.pr...
ea43897e-3503-4966-974f-10bb78390b26
7
public static void main(String[] args) { System.out.println("Starting Test Cases"); try { // Parse the command line args int policy = 0; if ( args[0].equals("t") || args[0].equals("time") ) { policy = ResourceCharacteristics.TIME_SHARED; ...
790a8ba5-fe9f-4c7d-96a5-e58830c3ac12
5
public IMessage crypter(IMessage clair, String key) { /* * Lecture de la clef, puis encodage des caractres un par un par * des oprations elementaires */ long d=new Date().getTime(); String keyAdaptee=this.adapter(key); int k; char[] c=new char[clair.taille()]; for(int i=0;i<clair.taille();i++) { ...
c68b6a2b-eb8e-421b-9273-c7b4fb39987e
3
public static void main(String[] args) { double num = -1; String in = scan.nextLine(); // parse in by spaces and go through and find the first string that // parsesDouble to a double, if it errors then try next. boolean foundNum = false; String[] splitBySpace = in.split(" "); for (int sb = 0; sb < splitBy...
5d0dc033-12ce-44ed-b92c-6602d3c7f050
5
public static Automaton cleanAutomaton(Automaton a) { Automaton ac = (Automaton) a.clone(); State[] s = ac.getStates(); Set useless = getUselessStates(ac); for (int i = 0; i < s.length; i++) { if (useless.contains(s[i]) && s[i] != ac.getInitialState()) ac.removeState(s[i]); } if (useless.contains(ac....
f1c03bad-86bc-4ff7-9fd4-3da9938acd55
6
public void handleException(Throwable ex, Window window) { if (ex instanceof YMethodNotFoundException) { logger.info(ex.getMessage()); } else if (ex instanceof YInvalidMVCNameException || ex instanceof YCloneModelException || ex instanceof YEqualsModelException || ex instanceof YComponentValidatio...
7463f328-2edf-40fc-a78f-3c3581e972f0
6
public void onPluginMessageReceived(String string, Player player, byte[] arg2) { if (string.equals("5ZIG")) { try { String response = new String(arg2); if (response.startsWith("/l/connect")) { response = response.replace("/l/connect", ""); ModUserLoginEvent e = new ModUserLoginEvent(player); ...
f998e03b-eb17-48c7-ab37-1c1b3654ccda
1
public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println( "Usage: java RFS826_TcpClient <destination host> <destination port>"); System.exit(1); } // get the dest host + port from console String dest_...
21aa7e49-3cd9-4ea5-8c19-f893384e8579
2
public static boolean existsName(Usuarios usu){ String sql = " SELECT * FROM usuarios WHERE usuario = '"+usu.getUsuario()+"' "; if(!BD.getInstance().sqlSelect(sql)){ return false; } if(!BD.getInstance().sqlFetch()){ return false; } return t...
0b708802-4f18-4f74-9de3-a43780e6d504
8
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof InstanceList)) { return false; } InstanceList<?> other = (InstanceList<?>) obj; if (clazz == null) { if (other.clazz != null) { re...
a6db13f7-823d-497a-a28d-28d7e30f51bc
6
protected IRemoteCallObject responseData(long connectionId, final IRemoteCallObject callObj) throws RemoteCallException, EndOfConnectionException { //..handler answer from client (with error or not) IRemoteCallObject response = callObj.getResponseRemoteCallObject(); if (callObj != null) { if...
84b3341b-1a48-4a9c-a4b4-56bf18c9f994
9
public static String convert(String s, int nRows) { if(nRows == 1 || s.length()<=nRows || s.equals("")) return s; String rs = ""; for(int i = 0; i < nRows; i++) { //in these rows, only exists primary elements if(i == 0 || i == (nRows-1)) { int...
4701a8f2-98fb-4dd2-bdc4-2a0feb539ddb
1
public boolean kontroliertEuropa(Spieler s) { boolean res = true; if(!s.fraktion.equals(laenderGraph.getLaenderList().getLandByID(1).getOwner())) { res = false; } return res; }
09fd16c7-6000-4f1e-8489-6835076ef6ef
6
public void printStack(int stackId){ switch (stackId) { case STACK_1: System.out.print("\n\n\nPrinting STACK_1 Contents : [ "); for(int i=0; i<head1; i++){ System.out.print(data[i*3]+",\t"); } System.out.println("]"); break; case STACK_2: System.out.print("\n\n\nPrinting STACK_2 Contents ...
bafb0b70-cbf3-4c1c-8a23-fb5938b33e52
9
private int getKthSmallestRecursion(int ai, int bi, int k) { printStatus(ai, bi, k); if (k == 2) { return get2ndSmallest(ai, bi); } int half_k = (k - 1) / 2; int mid_ai = ai + half_k; int mid_bi = bi + half_k; int aval = a.get(mid_ai); int bval = b.get(mid_bi); if (aval == bval) { //...
c048b227-a992-4ed3-9405-eddf1e40bef4
3
public boolean insertAt(int index, E element) { LinkedElement<E> oldElem = findElement(index); if (index == total) { addLast(element); // increments total return true; } if (index == 0) { addFirst(element); // increments total return true; } if (oldElem != null) { LinkedElement<E> new...
bfbc91fd-bbb4-4371-9527-e57869f697b6
3
@Override public Buildable create(Object name, Object value) { if (name.equals("model")) { if (model != null) { throw new IllegalArgumentException("Only one 'model' allowed."); } return model = new Model(); } else if (name.equals("output")) { ...
15757feb-30e4-4db3-bfbc-62790c72e932
0
public String getPath() { return path; }
425e1f53-c0db-4635-ba7e-bea70b19429e
4
public boolean serieValoradaVistaSeguida(Serie serie){ // Se comprueba si la serie es seguida por algún usuario. for (UsuarioRegistrado usuario : misUsuarios) { try{ Serie serieuser = usuario.buscarSerieSeguida(serie.obtenerTitulo()); }catch(Exception e){ ...
f121b318-5a12-40f4-ab91-9429f4c5c586
9
public static void openEditor(IWorkbenchPage page, ISelection selection, int lineNumber) { // Get the first element. if (!(selection instanceof IStructuredSelection)) return; Iterator<?> iter = ((IStructuredSelection) selection).iterator(); if (!iter.hasNext()) return; Object elem ...
454a595d-a6f9-45bb-9882-7316c5b1d9a8
1
public static List<TokenType> parse(CSVObject csv){ List<TokenType> types = new Vector<TokenType>(); types = new Vector<TokenType>(); String[][] data = csv.getData(); for(String[] line : data){ types.add(new TokenType(line[0], line[1], line[2])); } System.out.println("TokenType.parse() -> " + types + ";"...
6775a1ad-7da2-4175-a8c9-6f4be5055802
1
public void updateUserInfo() throws IOException { if (config.isDebugOn()) System.err.println("Updating user info. "+"$MyINFO $ALL "+getUsername()+" "+config.getDescription()+"$ <++ V:0.673,M:P,H:0/1/0,S:2>$ $LAN(T3)0x31$"+config.getEmail()+"$1234$|"); //hubCommunicator.sendDataToHub("$Versio...
f7b300de-eb3e-49d2-9506-64a4df166645
5
public static LinkedHashMap<String,Object> array_change_key_case(Map<String,Object> hm, String upperLower) { LinkedHashMap<String,Object> output = new LinkedHashMap<String,Object>(); if (hm == null) return output; if (upperLower == null) upperLower = "LOWER"; for (Map.Entry<String,Object> entry : hm.entrySet())...
e575da1a-895b-42dc-8ea1-0fa3aa5ad574
6
private static void getAccessAndRefreshTokensFromAuthorizationCode( TokenType t) { flagAccessToken = false; // builds POST parameters List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("client_id", clientId)); parameters.add(new BasicNameValuePair("clie...
09295c30-5cf4-43b7-b87d-cabb8017d9c1
0
public Lemonade() { this.setName("Lemonade"); this.setPrice(new BigDecimal(15)); }
259c8438-ac3c-4a90-8033-48cb0682cf6a
1
public boolean isLibre() { if(controleur==null) return true; else return false; }
a9d9b841-1015-4573-9fb2-5e2500143f07
3
private TileState stateFrom(boolean is_passable, boolean is_opaque) { if (is_opaque) { if (is_passable) { return TileState.PASSABLE_OPAQUE; } return TileState.IMPASSABLE_OPAQUE; } else { if (is_passable) { return TileState...
e90c2d16-a11c-45f0-ac3a-762d966c9c32
3
private static void callRightMethod(CommandLine cli) throws FileNotFoundException, IOException { Mode mode = getMode(cli); System.out.println("Starting with mode = " + mode); final String sourceDirectory = cli.getOptionValue('s'); final String destDirectory = cli.getOptionValue('d')...
4772a5eb-5d4f-4c58-a098-b81b165e8c89
4
@Override public void actionPerformed(ActionEvent e) { int dialogButton; BmTestManager bmTestManager = BmTestManager.getInstance(); if ("start".equals(e.getActionCommand().toLowerCase())) { if (bmTestManager.getUserKey().isEmpty()) { JMeterUtils.reportErrorToUser(...
3541c4cd-4671-4306-ade6-924e4c90beb0
4
public String init() { user_dao.regisUser("kimapiwat","1234"); project_dao.saveProject("Assasin creed"); project_dao.saveProject("Call of Duty 4"); project_dao.saveProject("Battlefield"); project_dao.saveProject("Walking Dead"); project_dao.saveProject("Breaking Dawn"); project_dao.saveProject("Taylor...
9867eb59-3e8d-4430-9d85-fedf4d8e870a
2
private String getPropertyValue(final Properties properties, final String propertyTag, final String defaultValue) { String value = properties.getProperty(propertyTag); if (value == null) { value = defaultValue; } else if (value.isEmpty()) { value = defaultValue; } return value; }