method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
55a69196-7c4e-45dd-8d61-80543b9b74dd
1
public void setConnection(Connection c) { if(this.c != null) { connectionSemaphore.acquireUninterruptibly(); net.clear(); } this.c = c; connectionSemaphore.release(); }
7fdac654-6a55-4671-899e-de968f86b11b
2
public void addShape() throws NumberFormatException, IOException { int choice = 0; System.out.println("What shape would you like you add?"); choice = Integer.parseInt(Wrapper.getUserInput()); switch (choice) { case 0 : addPoint(); break; case 1 : addParticle(); break; } }
813c1f77-9150-4af0-81c6-207ed6d09dd6
8
byte[] resizeCollection(byte[] collectionData, int objectRefSize) throws IOException { ByteBuffer input = ByteBuffer.wrap(collectionData); ByteArrayOutputStream output = new ByteArrayOutputStream(collectionData.length); short type = (short)(0xff & input.get()); int numberOfItems = (colle...
ad32af60-cbe0-4840-a79d-42d32a3c3075
1
@Override public void configure(AbstractCommand command, String[] args) { TimeBanRmCommand rmCommand = (TimeBanRmCommand) command; if (CommandLineParser.isOptionPresent(args[0], 'a')) { rmCommand.setRmAll(true); } else { List<String> players = CommandLineParser.getLis...
e22a9809-2ab0-4c43-a48c-406cc9abbff3
3
private static String formatEdgeLabel(String label) { if(label==null) return ""; StringBuilder builder = new StringBuilder(); for(String element : label.split(";")) { if(builder.length()>0) builder.append("\\n"); builder.append(ensureTextIsVal...
5497dc10-1708-479d-a910-97b9a18280db
1
private void establishConnection() { log("Attempting a connection to " + ip + ":" + port + " as " + username + "..."); boolean connect = packetFactory.connect(); log(connect ? "Connected!" : "Could not connect."); connected = connect; packetFactory.sendMessage("/c/" + username); ...
059d6639-b21d-485c-a08a-70cc7505b1b8
1
public static void main(String[] args) { if(args.length == 0) { System.out.println("please provide some string as argument."); return; } String name = args[0]; StringBuilder pngName = new StringBuilder(name); pngName.append(".png"); ...
d01f0036-f35f-4f7c-abd5-7888bcd96f09
7
private void readFileToSeqString(File file) throws IOException { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String name = null; String sequence = ""; String temp = ""; while (true) { temp = br.readLine(); if(temp != null)temp = temp.toUpperCase(); //Because ...
843d0483-9e8c-4d58-bf6d-91b5bd10cf6d
6
public void onEnable() { config = new Config(); storage = new PersistantStorage(this); config.load(this, storage); config.banHandler = new BanHandler(config, storage, this); config.FilterList = this.getConfig().getStringList("Word Filter.Filtered Words"); MessageCountTimer = new Timer(); SaveTimer = new ...
3a7b14ae-1d5c-4004-89ef-6ca6837c3fd5
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
0af20313-4abf-4d99-872a-5734b16af1a1
2
public long getDecimalInput(){ if(!this.inputSet)throw new IllegalArgumentException("No input has been entered"); if(!this.trueDtoA){ System.out.println("Class - DtoA; method - getDecimalInput"); System.out.println("This instance of DtoA is not a true simulation of an DAC"); ...
b9002021-5c0b-4fce-886f-58a54af5ab60
3
private void setUpIp() throws UninstantiableException { OneResponse rc = vm.info(); if (rc.isError()) throw new UninstantiableException(); Pattern p = Pattern .compile("<IP_PUBLIC><!\\[CDATA\\[*([^\"]*)\\]\\]></IP_PUBLIC>"); Matcher m = p.matcher(rc.getMessage()); String ip = ""; if (m.find()) { ...
2f027787-9e75-47dc-a53c-39e36ed12977
2
private void isGreaterThanString(String param, Object value) { if (value instanceof String) { if (param.compareTo((String) value) < 0) { throw new IllegalStateException("String is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
6709557e-10be-4a0f-856c-c4cb5e7b656f
3
@Override public void action(Action action) { switch (action) { case OPEN_CLOSE: break; case ASCEND: break; case DESCEND: GlobalGame.game.dungeonHandler.enterDungeon(parent.world_position); explored = true; ...
c3b6e89e-2fd6-47b6-a3ff-c814650a240c
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...
505e0f5c-25ff-4f3b-a1a6-af161e8b3bb0
8
public boolean isTheSamePersonAs(Author externalAuthor) { //this method needs to log every time it assumes Person A is equal to //Person B when their details aren't exactly the same //we're taking a Best Guess approach with last name and first initial //and in the event that...
94c852c2-2dd5-460a-89b4-d920f450695d
1
public boolean isEmpty() throws Exception { boolean retVal = false; if (topPtr == CAPACITY) { retVal = true; } return retVal; }
d3c5a85c-e736-4e74-b0b0-f233991cf12c
8
public UserInfo setUserInfo(String username, String password, String newPassword, String name, String organization, String position, String phone, String email, String extraInfo)throws XMPPException{ if(newPassword != null && newPassword.length() < 6) throw new XMPPException(new XMPPError(XMPPError.Co...
ee4aa97c-a6c8-4af0-a107-37ce8caecabf
1
public void setValueAt(Object val, int index) { if (type == Integer.class) { int[] foo = (int[])vals; foo[index] = ((Integer)val).intValue(); } else { double[] foo = (double[])vals; foo[index] = ((Double)val).doubleValue(); } }
714147f1-f24b-40b3-9e2f-cfc929ded737
6
public QUDG() throws CorruptConfigurationEntryException { // only call the first time a QUDG object is created if(! initialized) { // speed up by comparing the squared distances (needs not take the square root to get the distance) r_min = Configuration.getDoubleParameter("QUDG/rMin"); r_min_squared = r_mi...
0b5a8d36-5067-44bf-8d88-4592a8292e9f
1
public static List<Sentence> parseSentence(String paragraph) { List<Sentence> sentences = new ArrayList<>(); String[] strings = paragraph.split("[.?!]"); for (String string : strings) { sentences.add(new Sentence(string)); } return sentences; }
2915e3ae-e118-4463-97c0-d29ce9b889b8
6
public void dumpHeader(TabbedPrintWriter writer) throws java.io.IOException { writer.println("/* " + className + " - Decompiled by JODE"); writer.println(" * Visit " + GlobalOptions.URL); writer.println(" */"); if (pkg.length() != 0) writer.println("package " + pkg + ";"); cleanUpImports(); Iterator ite...
21437e5f-e44b-4deb-a212-52d65c84bddd
7
private float excite() { if (!atom.hasElectrons()) return 0; Electron e = atom.getElectron(0); EnergyLevel level = e.getEnergyLevel(); ElectronicStructure es = model.getElement(atom.id).getElectronicStructure(); int n = es.getNumberOfEnergyLevels(); int m = es.indexOf(level); if (m == -1 || m >= n - ...
c764fa69-c397-4332-b1b5-b9e68cdc0d3c
2
private void sendHandshake() throws Exception { String path = uri.getPath(); if (path.indexOf("/") != 0) { path = "/" + path; } int port = getPort(); String host = uri.getHost() + (port != WebSocket.DEFAULT_PORT ? ":" + port : ""); String origin = "x"; // TODO: Make 'origin' configurable Handshake...
149bfbf2-b9b0-476f-ab17-801bd575236e
3
@Override public int doStartTag() throws JspException { try { if (msg != null && !msg.isEmpty()) { JspWriter out = pageContext.getOut(); out.write("<div id='" + classErr + "'>"); return EVAL_BODY_INCLUDE; } } catch (IOException ...
8ebe19ca-7e69-4a1c-9adc-8f17e7262199
1
private final String generateNonce () { final char[] VALID_NONCE_CHARS = new char[] { 'a', 'b', 'c' , 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; String str = ""; for (int i = 0; i < 10; i++)...
2746d9a7-0d85-459a-b788-a54c304f80bf
8
private BitSet selectTextBoxes(String str) { int n = view.getNumberOfInstances(TextBoxComponent.class); if (n == 0) return null; BitSet bs = new BitSet(n); if ("selected".equalsIgnoreCase(str)) { for (int i = 0; i < n; i++) { if (view.getTextBox(i).isSelected()) bs.set(i); } return bs; } ...
8c96e28a-bd1d-46ff-8eed-ac9510def7b7
5
public PlayerData(String n) { name=n; games=new LinkedList<String>(); tournyscore=new LinkedList<String>(); if (new File(n).exists()) { try { BufferedReader in = new BufferedReader(new FileReader(n)); String str; in.readLine(); while ((str = in.readLine()) != null) { String[] s...
6057c52a-3b3d-48e4-9c58-8fcad69b6ef0
6
private final void downHeap() { int i = 1; T node = heap[i]; // save top node int j = i << 1; // find smaller child int k = j + 1; if (k <= size && lessThan(heap[k], heap[j])) { j = k; } while (j <= size && lessThan(heap[j], node)) { heap[i] = heap[j]; // shift up ch...
b4bb50f3-fd8a-46f1-8b07-0e6056b8b756
0
public void setEventBranch(final EventBranch eventBranch) { this.eventBranch = eventBranch; }
88d6688b-6941-4a63-a1cd-ebf24e829d29
1
@RequestMapping(value = "/all-event-comment-list/{hallEventId}", method = RequestMethod.GET) @ResponseBody public EventCommentListResponse eventCommentList( @PathVariable(value = "hallEventId") final String hallEventIdStr ) { Boolean success = true; String errorMessage = null; ...
9925e52a-b9c3-42c5-bcf8-036d720075ed
5
public void moveTo(Location newLocation) { if (grid == null) throw new IllegalStateException("This actor is not in a grid."); if (grid.get(location) != this) throw new IllegalStateException( "The grid contains a different actor at location " ...
d251e98f-5194-4d26-bc81-7d2971eea0e4
4
public void SetLampColor(int c) { switch( c ) { case 0: IluminationColor = Color.black; break; case 1: IluminationColor = Color.green; break; case 2: IluminationColor = Color.yellow; break; case 3: IluminationColor = Color.red; break; } // switch repaint(); } ...
886d3696-14cf-41e5-b5de-9467f5cc0277
3
@Override public void report() { final List<String> busiestActors = new ArrayList<>(); int highestCount = 0; for (final Map.Entry<String, Integer> actorYearToMovieCountEntry : actorYearToMovieCount.entrySet()) if (actorYearToMovieCountEntry.getValue() > highestCount) { ...
48492d3e-33db-4db8-9034-73bd968c09cf
5
public static Map<String, Integer> buidColumnIndexMap(final List<ColumnMetaData> columns, final Parser p) { Map<String, Integer> map = null; if (columns != null && !columns.isEmpty()) { map = new HashMap<String, Integer>(); int idx = 0; for (final ColumnMetaData meta ...
2b1fb013-29fe-407b-be3e-9fb73c903a78
8
protected Node representMapping(Tag tag, Map<? extends Object, Object> mapping, Boolean flowStyle) { List<NodeTuple> value = new ArrayList<NodeTuple>(mapping.size()); MappingNode node = new MappingNode(tag, value, flowStyle); representedObjects.put(objectToRepresent, node); b...
b9927596-b74a-41cf-88bd-df422aca49bf
1
public ControlledBird(Vector2 position, float radius, Vector2 velocity, float maxSpeed, Vector2 heading, float mass, Vector2 scale, float turnRate, float maxForce, BirdMinigame minigame) { super(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce); try { birdSheet = new Sp...
6aad14ea-e0f0-4a8c-aa58-eadb6c27be7f
6
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("userID")) accountStatus.setUserID(getInt()); else if (qName.equals("paidUntil")) accountStatus.setPaidUntil(getDate()); else if (qName.equals("createDate")) accountStatus.setCreateDate(ge...
6cb0d62e-d8e2-4475-afb0-d293ab4a5d9d
3
public void op2() { if(have(Token.Kind.MUL)){ expectRetrieve(Token.Kind.MUL); } else if(have(Token.Kind.DIV)){ expectRetrieve(Token.Kind.DIV); } if(have(Token.Kind.AND)){ expectRetrieve(Token.Kind.AND); } }
33f6dcf3-8b3f-438a-a8e9-ffad6997737b
7
public String[] read() { String[] terms = new String[100]; File file = new File(fileName); String line1, line2; try { BufferedReader in1 = new BufferedReader(new FileReader(file)); if (oneTerm) { for (int i = 0; i < terms.length; i++) { ...
0ef9aee0-9d1e-44f4-977a-e909c4447848
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Medico)) { return false; } Medico other = (Medico) object; if ((this.numeroColegiado == null && other.numeroCol...
1563d4d7-e2cf-40a1-8908-032c4cc2561b
1
public T extractMax() { if (size == 0) throw new ArrayIndexOutOfBoundsException("the array is already empty"); T head = heap.get(0); heap.set(0, heap.get(--size)); siftDown(0); return head; }
1101ac5f-0a17-4417-8f71-4f435493a766
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
9abbfc0f-37a4-4b0e-be92-a59b34ff852a
4
private static void checkForLoop (ForagerAnt fAnt) { boolean nodeFound = false; // Sets the node on the top of the stack to be examined ColonyNodeView startingNode = fAnt.movementHistory.peek(); // Creates a stack containing the forager ants movement history Stack<ColonyNodeView> foragerAntStack = null;...
56bdb07c-5595-4531-bd88-cf986f3e3abd
2
public static void ChooseBrian () { if (Game.characterChoice == 1) { Game.CharacterOne = "Brian"; Game.CharacterOneHP = CharacterStats.BrianHP; Game.CharacterOneAttack = CharacterStats.BrianAttack; Game.CharacterOneMana = CharacterStats.BrianMana; Game.CharacterOneRegen = CharacterStats.B...
bee111bc-7570-4dbe-877b-56308fe8b85e
0
public PINPolicyType getPINPolicy() { return pinPolicy; }
eb08d293-7327-4acf-97de-487fa97739e1
0
public static Test suite() { return new TestSuite( AppTest.class ); }
c6d15873-20c4-4024-be73-7efa214d2248
0
@Override public long getIdleTimeout() { return idleTimeout; }
b7976a36-f198-42e8-99dd-c326448a7f07
9
private final void method281(byte i) { anInt283++; boolean bool = false; int i_14_ = 0; int i_15_ = 0; Class348_Sub5 class348_sub5 = (Class348_Sub5) aClass262_292.getFirst(4); int i_16_ = 50 / ((-34 - i) / 45); for (/**/; class348_sub5 != null; class348_sub5 = (Class348_Sub5) aClass262_292.nextForw...
12eb9a65-4386-4b56-9f7d-69964a302ea1
0
public void setSequence_Id(int sequence_Id) { this.sequence_Id = sequence_Id; }
3855705a-4847-487f-8146-7326bc087f05
6
public String addNode(String region, String agent, String plugin) { String node_id = null; int count = 0; try { while((node_id == null) && (count != retryCount)) { if(count > 0) { //System.out.println("ADDNO...
fe066a71-7d20-48bb-a657-0739e179bc6f
0
public void setHospitalidHospital(Hospital hospitalidHospital) { this.hospitalidHospital = hospitalidHospital; }
adbc1a01-d648-4107-8dd5-8a7c37df978f
2
int stringToInteger(String s) { int res = 0; for (int i = 0; i < s.length(); i++) { res = (res << 1) + (s.charAt(i) == 'a' ? 0 : 1); } return res; }
a40dba28-6b71-4ac1-a2d0-b5770ed1ed12
3
private static void registerCommonClasses(Class<?>... commonClasses) { for (Class<?> clazz : commonClasses) { commonClassCache.put(clazz.getName(), clazz); } }
8ab27f8e-a10b-461e-9e54-ec503bf57ced
1
public void reachableClass(String clazzName) { ClassIdentifier ident = getClassIdentifier(clazzName); if (ident != null) ident.setReachable(); }
79cfcfad-b203-453d-a0c3-76d9231afabd
6
private boolean testVertical(String[][] allMarkers) { for (int i = 5; i >= 3; i--) { for (int j = 0; j <= 6; j++) { if ("_".equals(allMarkers[i][j])) {} else { if (allMarkers[i][j].equals(allMarkers[i-1][j]) && allMarkers[...
a259802a-cb5a-42f9-8a40-34c738923e53
0
public static Hand ThreeOfAKind(Rank tripsRank, Rank firstKicker, Rank secondKicker) { return new Hand(HandRank.ThreeOfAKind, null, tripsRank, firstKicker, secondKicker, Rank.Null, Rank.Null); }
f98f4078-e355-4501-b539-e987bbf44a3d
3
@Override public void onEntityHit(Player p, MapObject mo) { flicker = true; int dmg = p.getAttackDamage(); int wepDmg = 0; ItemStack wep = world.getPlayer().invArmor.getWeapon(); if(wep != null && 3 == ((ItemTool)wep.getItem()).getEffectiveness()) wepDmg = ((ItemTool)wep.getItem()).getEffectiveDamage()...
9e77f8c3-58a6-4d8c-8280-81c1bb6cf1ca
1
@Override public void render(float delta) { Gdx.gl.glClearColor(0.56f, 0.165f, 0.1f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); pauseView.draw(); if (Gdx.input.isKeyPressed(Keys.BACK)) { this.roundScreen.resumeGame(); this.game.setScreen(roundScreen); } }
9b11da3b-c2f2-4578-9345-6882ebdb595a
8
public void render() { bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } g = bs.getDrawGraphics(); g.drawImage(image, 0, 0, getWidth(), getHeight(), null); if (state == STATE.GAME) { screen.clear(); double xScroll = player.getX() - screen.width / 2; double yScro...
1b3acf35-503a-41ff-849d-8f327433fd24
9
private void init(String xmlFileName) { if(xmlFileName == null) throw new NullPointerException("xml file name is null"); generated.Monopoly XMLgame = MonopolyUtils.createObjectFromXml(xmlFileName); if (XMLgame == null) throw new NullPointerExceptio...
2c219cd7-e92c-434f-9a9c-575990623221
5
public static HashMap<TowerType, TowerData> loadTowerStats(String xmlFilePath) { HashMap<TowerType, TowerData> statsMap = new HashMap<>(); NodeList types = getElements(xmlFilePath, "type"); for(int i = 0; i < types.getLength(); i++){ Element towerType = (Element) types.item(i); RangedAttack attack = (Range...
7996e268-3327-4ee7-8e43-ce46d1d4d63a
3
public static String param(String file) { File param = new File(file); if (!param.isAbsolute()) { String work = System.getProperty("oms3.work"); if (work == null) { return "Error no $work property found, use full qualifies name instead.)"; } ...
f1bb066e-bb40-4a25-a865-a2ce7c649100
7
@Override public void sort(SorterParams sParams) { int[] theArray = sParams.getArrayToSort(); int[] gapArray = sParams.getGapArray(); MemoryUsage.addMem(gapArray.length); MemoryUsage.addMem(1); for(int k = 0; k < gapArray.length; k++) { ...
960d3bb7-4c60-4bda-95c7-3731412ca537
5
@Override public void characters(char[] ch, int start, int length) throws SAXException { String value = new String(ch, start, length); Object tos = objectStack.size() > 0 ? objectStack.peek() : null; FieldRef fieldRef = null; try { if (tos instanceof GedcomTag) { ((Gedcom...
ea23bf1b-e37a-4901-aed1-e5a075a81aa8
7
private static void processNextKey() { WatchKey nextKey; try { nextKey = watchService.take(); // wait for the next key to throw an event // iterate the events that occured on this key for (WatchEvent watchEvent : nextKey.pollEvents()) { ...
4e63846b-f701-4143-ad2d-30363573135c
3
public void feedforward() { for (int i = 0; i < neurons.size() - 1; i++) { for (Neuron startNeuron : neurons.get(i)) { for (Neuron endNeuron : neurons.get(i + 1)) { new Axon(startNeuron, endNeuron, this.seedmin, this.seedmax); } } } // if (startNeuronLayer >= neurons.size() // || endNeuronLa...
26430caa-c11f-4324-9055-503f0c28380b
8
@Override public Query parse() { if(!this.prepared) { this.prepared = true; StringBuilder sB = new StringBuilder(); sB.append("INSERT INTO "); sB.append(this.into.replace("#__", this.db.getPrefix())); sB.append("\n"); sB.append("("); for(int i = 0; i < this.fields.size(); ++i) { if(i...
fe9a1abd-77f1-49b4-bb7d-1e66fe5480c1
3
public User getUser(String email) { //TODO: Save User bean as field to return? initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; User user = null; try { //Prepare Statement preparedString = "SELECT email,firstname,lastname FROM users WHERE email = ?...
94cf39e2-2b4c-4c58-b04b-1683ad404372
8
private void fillEntityLists() throws SQLException { if (!currentEntity.hasEntityList()) { return; } final Collection<SimpleEntityAssociation> associations = listAssociations; listAssociations = new ArrayList<>(); for (final ListScope entityList : currentEntity.getEntityLists()) { fina...
9b23fa3e-1dc2-4ca6-91b6-80d718d36a16
7
public static ArrayList<InveList> queryEvaluation (ArrayList<Node> queryTree, int queryID, String IsRanked) throws IOException { ArrayList<InveList> result = new ArrayList<InveList>(); if (currentNode.getIsOperator() == 0) { //use recursive method //if current node is not an operator //return its inverte...
283858b4-2a6e-4446-a15b-faa8ac9d6fd5
6
public static boolean fullHouse(Hand hand) { hand.sortByValue(); if( ((hand.getCard(0).getValue() == hand.getCard(1).getValue()) && (hand.getCard(0).getValue() == hand.getCard(2).getValue())) && (hand.getCard(3).getValue() == hand.getCard(4).getValue() ) || ( ((hand.getCard(4).getValue() ...
d02e3bfb-e605-44cc-9d81-21b4156c5fd4
2
private ArrayList<Edge> getEdges() { try { //Get time, Connection and ResultSet Long time = System.currentTimeMillis(); Edge edge = null; String sql = "SELECT FNODE#, TNODE#, TYP, VEJNAVN, VEJKODE, SPEED, LENGTH FROM [jonovic_dk_db].[dbo].[edges];"; Co...
e72a4ba1-473d-4e5a-90e8-0853aab1a221
5
public static void main(String[] args) { final int PADDING = 50; final int SCALE = 40; final int TIMEOUT = 1000; // Millis final Random random = new Random(System.nanoTime()); final World world = new World(); final Map<CoordPair, Turtle> turtles = new HashMap<>(); world.setBackground(Color.BLACK); // Shou...
d794aa79-7959-4d4a-b312-5ec6ece4fcbb
1
public void test_LocalDate_toDateMidnight_Gaza() { LocalDate date = new LocalDate(2007, 4, 1); try { date.toDateMidnight(MOCK_GAZA); fail(); } catch (IllegalInstantException ex) { assertEquals(true, ex.getMessage().startsWith("Illegal instant due to time zone ...
fca168fd-aa58-4ed4-a510-8da61461f0e4
9
@Override public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; Rendering rendering = (Rendering) o; if(image.equals(rendering.image)) return true; if(!(image.getWidth() == rendering.image.getWidth())) return ...
94beecaa-bc8e-4f49-a53f-530e889ca4b7
1
public void addModule(String moduleName){ int currentFragmentIndex = fragments.indexOf(moduleName); if(currentFragmentIndex < 0){ fragments.add(moduleName); return; } fragments.add(fragments.remove(currentFragmentIndex)); }
ea0ac41b-4121-406a-8753-922c826100b5
0
public static Font getQuestionPriceFont() { return questionPriceFont; }
ecbb7140-e5e2-4615-a283-c86d4640a44e
3
private List<PegsPoint> getPlaces() { List<PegsPoint> placeList = new ArrayList<PegsPoint>(); for (int y = 0; y < height; y++) { for (int x = 0; x < height; x++) { if (mask[y][x] == _) { placeList.add( new PegsPoint( x, y ) ); } } } return placeList; }
40e1504b-10d4-4883-9a06-47172f5373f4
6
private void processFailure(Sim_event ev) { if (ev == null) { System.out.println(super.get_name() + ".processFailure(): " + "Error - an event is null."); return; } Object obj = ev.get_data(); if (obj instanceof FailureMsg) ...
65061aa4-5b14-4f0f-bb6e-9e39d48afa1b
9
public static int countCompany(String eDatabase) throws SQLException{ Connection gCon = null; // general connection to MYSQL Connection eCon = null; // connection to database Statement eStatement = null; // statements for the eDatabase ResultSet result = null; int count = 0; try{ ...
32b878ac-09e6-483e-89f9-a985a9cdc733
4
private void select() { if (currentChoice == 0) { Player.path = "/Sprites/Player/Greendrag/playersprites.gif"; FireBall.path = "/Sprites/Player/fireball.gif"; WorldOneMap.mapHeadPath = "/Sprites/Player/Greendrag/iconGreen.gif"; gsm.setState(11); // JukeBox.stop("menuMusic"); } if (currentChoice...
4e58ab2a-9408-466e-b601-9ed1f75ef3d9
7
private String removeModChar(String modProtein){ //If modified stops are starts are disabled, just ignore this call if(!Properties.useModifiedStopsAndStarts){ return modProtein; } //If a premature stop is found, remove everything after that point int prematureStopLoc; if((prematureStopLoc = modProtein.in...
abafcd36-fe5b-431f-a82b-9e7680a5564c
2
public double getVolume() { double totalVolume = super.getVolume(); // first, get volume of just itself // System.out.println("Volume of just " + getName() + ": " + totalVolume); // add volume of all contents if this is not a chest if(!(this instanceof Chest)) { for(Contai...
72c0d026-8be4-42d8-8681-01577dcdc91f
3
@Test public void testPipelinedWriteBack() { Thread t = new Thread(pipelinedWriteBackStage); t.start(); pipelinedWriteBackStage.receive(new OperandImpl(22)); //Supply stage with a result value try { testExecuteToWriteQueue.put(testInstrDIV); //Put test instruction into queue for passing to wbStage } catch...
53d575a4-c8cc-4e00-9603-5e0510f29ee1
8
public Personnel load(long personalNr) throws Exception { // Try to find it in the cache first: Personnel e = cache.get(personalNr); if (e != null) { return e; } ResultSet rs = executeSQLQuery("select * from MitarbeiterAlleKlassen p" + " where p.perso...
afb5fa31-0a81-4a6c-8977-0e43dfb7ebcc
8
public void method545(Stream stream, Class29 class29) { int i = stream.readUnsignedByte(); anIntArray665[0] = i >> 4; anIntArray665[1] = i & 0xf; if(i != 0) { anIntArray668[0] = stream.readUnsignedWord(); anIntArray668[1] = stream.readUnsignedWord(); int j = stream.readUnsignedByte(); for(int k =...
139b1321-8b25-4401-ba47-0f94c4e25e30
8
public Player(PlayerCanvas parentCanvas) { // Initialise keymap: System.out.println("Begin initalising key bindings..."); playerKeyMap = new InputMap(); playerKeyMap = parentCanvas.getInputMap(JComponent.WHEN_FOCUSED); playerActionMap = new ActionMap(); playerActionMap = parentCanvas.getActionMap(); // D...
09c30e04-6e32-41fc-b683-b780a9e4079e
1
public void addSecEdge(String[] secEdge) { try { getNode(secEdge[0]).addEdge(secEdge[2], secEdge[1]); } catch (Exception e) { System.out.println("ERROR: could not add second edge from iderf: " + secEdge[0] + " to idref: " + secEdge[2] + " with label: " + secEdge[1]); } }
2a04c615-9880-4544-9599-db4fe78437ca
4
public void testStringLargeArrayArraycopy() { String[] data = new String[]{"a", "ab", "abc", "ąęć", "1234", "test string", "ANOTHER TEST STRING", "", "\n", "\r"}; int startPos = 2; int length = 8; LargeArray.setMaxSizeOf32bitArray(1073741824); StringLargeArray a = new StringL...
fd1bf884-fd82-4c07-a76a-48cbb628c9c9
6
private static int findMatchingBracket(String input, int start) { char last = 0; int level = 0; for (int index = start; index < input.length(); index++) { switch(input.charAt(index)) { case '{': if (last == '{') { last = 0; ...
53d4e3d4-ec24-43c5-8362-773b212b58e2
6
@Test public void isUpperTriangle() { // test matrices that are upper triangular to various degree hessenberg for( int hessenberg = 0; hessenberg < 2; hessenberg++ ) { DenseMatrix64F A = new DenseMatrix64F(6,6); for( int i = 0; i < A.numRows; i++ ) { int s = i...
29bbd939-a99c-43c2-ab6b-0e57b09b7e20
3
private void fetchData() throws IOException { if (!eos) { // copy 4096 bytes from compressed stream to syncState. int index = syncState.buffer(4096); if (index < 0) { eos = true; return; } int bytes = in.read(syncState.data, index, 4096); syncState.wrote(bytes); if (bytes == 0) { eos...
efb27e4a-c8d3-4ead-8d9a-eac8e3d0c213
1
public Bomber(int number, int bombs, Match match, String projectFolder) { this.number = number; this.bombs = bombs; this.match = match; this.cooldown = 0; if (!projectFolder.endsWith("/")) { projectFolder += "/"; } this.commandLocation = projectFolder ...
d5c99709-3885-43a0-9f85-4a4bbb9e29ba
9
private Word.Polarity getNearestNeighbour(ArrayList<Score> scores) { Word.Polarity polarity = Word.Polarity.UNKNOWN; int numPositive = 0, numNegative = 0, numNeutral = 0, numUnknown = 0; // Make sure k value is not greater than number of scores int limit = scores.size(); if (k <...
ba012bce-873d-45cd-9108-44d1c2af6d9a
4
public void setLocale(Object loc) throws JspTagException { if (loc == null || (loc instanceof String && ((String) loc).length() == 0)) { this.locale = null; } else if (loc instanceof Locale) { this.locale = (Locale) loc; } else { this.locale = ...
56ba1a6f-e28b-4ffa-8540-1ee992a019dd
2
private void parseCacheUpdateDefinition(CacheUpdate cacheUpdate, Method method) throws DaoGenerateException { CacheDelete[] deletes = cacheUpdate.delete(); VerUpdate[] updates = cacheUpdate.update(); for (CacheDelete delete : deletes) { CacheDeleteDefinition definition = new CacheDeleteDefinition(delete, meth...
69de28a4-aca0-42dc-b648-6b4c014f6d04
2
public void turn() { if(turn==0) { this.awakenEffect(); } else if(turn==duration) { this.closeEffect(); } else { this.applyEffect(); } turn++; }
1c0eaa42-89a8-42cb-a356-e72bc6499cb9
6
public void test3() { if (b) { System.out.println("Hello."); } else if (b || (new Integer(i)).toString().contains("Whatever") && new Double(d).compareTo(new Double(5.0)) > 55 || !(i >> 2 > 0) && (new String()) instanceof Object) { System.out.println("Hello."); } else { ; ...
0ab34061-4e35-48d9-926f-31c4f5ac8ed2
0
public Piece getCourante() { return courante; }