method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ccb570b1-63bc-46b8-a35a-8e12b01ac2a2 | 8 | protected boolean computeCell(int col, int row)
{
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < 2) nextCell = false;
if (liveCell && (neighbours == 2 || neighbours == 3)) nextCell = true;
if (liveCell && neighbours... |
913fe8f9-c080-4fe2-b18c-5bab036c64ce | 3 | public static ArrayList<bConsultaCompo> getPesquisaCompo(String prod, String data_in) throws SQLException, ClassNotFoundException {
ArrayList<bConsultaCompo> sts = new ArrayList<bConsultaCompo>();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
... |
45f88ab1-2ed1-407e-a24c-11b2dbeb3a20 | 8 | public String getEndConditionSummary() {
StringBuilder sb = new StringBuilder("This game ends when; ");
int i = 0;
if(nrOfFlips > 0) {
if(i++ > 0)
sb.append(" or ");
sb.append("the mode has flipped from building to battle: ").append(nrOfFlips).append(" times");
}
if(winningScore > 0) {
if(i++ > 0... |
ce28c969-0b65-4c0d-9976-d9a67ef3e0e9 | 0 | public State hasChosenCharactersState() {
return hasChosenCharactersState;
} |
57c1577a-7466-4e34-9757-e3c08d92a6d9 | 3 | public static String saveDirectory() {
try(BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
prop.load(reader);
return prop.getProperty("saveDirectory");
} catch (IOException ex) {
try {
PropHandle.reset();
... |
aa24de09-2fb7-4886-aaa0-97bfdbbf8a3d | 6 | public void draw(Bitmap render, int xOffset, int yOffset)
{
for(int y = 0; y < render.height; y++)
{
int yPix = y + yOffset;
if (yPix < 0 || yPix >= height)
continue;
for(int x = 0; x < render.width; x++)
{
int xPix = x + xOffset;
if (xPix < 0 || xPix >= width)
continu... |
48810894-ba1d-431a-92ef-029538472d78 | 3 | public static void main(String[] args){
DecimalFormat df = new DecimalFormat("0.0#Hz");
String str;
Note myNote = new Note();
System.out.println("Note Length :"+myNote.getLength());
System.out.println("Note Value :" + myNote.getValue());
if(myNote.isNatural())
... |
78bdd119-bb18-4fd7-b2e0-af8b80622b03 | 3 | public void setAvalie(PExpLogica node)
{
if(this._avalie_ != null)
{
this._avalie_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this)... |
e2b5b97c-6a50-4023-a4ab-b4c3a2133efa | 1 | public void poistaPalaute(Palaute p) throws DAOPoikkeus {
try {
PalauteDAO pDao = new PalauteDAO();
pDao.poistaPalaute(p.getPalauteID());
} catch (DAOPoikkeus po) {
throw new DAOPoikkeus("Tietokannasta poistaminen ei onnistunut", po);
}
} |
48aa052f-8a6c-4753-9e3a-60fc6ae42311 | 2 | public void joinUserInChannel(ChatChannel chatChannel, User user){
try{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String selectUserFromChan... |
7765651b-6a04-4bb6-906b-a05d02106aa0 | 2 | public void setUp()
{
// Get questions
List<Question> allQuestions = DbAccess.getAllQuestions(false);
// creates values for size of list
QuestionCount = allQuestions.size();
if(QuestionCount == 0)
{
// Set Values
QuestionText_t... |
67fd13bc-96f2-42cb-a929-9ea3c8bf7344 | 7 | public static Jeu creerJeu(Utilisateur utilisateur, String nom, String description, byte[] icone, String iconeType)
throws ChampInvalideException, ChampVideException{
if (utilisateur.getRole().getValeur() < Role.Utilisateur.getValeur())
throw new InterditException("Vous devez être connec... |
5fd68214-d57f-4708-b7f1-ec938673a685 | 0 | public void setCallgraphAlgorithm(CallgraphAlgorithm algorithm) {
this.callgraphAlgorithm = algorithm;
} |
314758fb-9efa-4adb-8074-ba5c32690be4 | 5 | void menuLoad() {
animate = false; // stop any animation in progress
// Get the user to choose an image file.
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
if (lastPath != null)
fileChooser.setFilterPath(lastPath);
fileChooser.setFilterExtensions(OPEN_FILTER_EXTENSIONS);
fileChooser.setFil... |
fb7bcc3a-522c-4144-a96f-dbcd7576005c | 3 | @Override
public String lookup(String question) {
// Tjek om der er valgt et spil
if (currentgame == null) {
return null;
}
// Find spørgsmål
for (int i = 0; i < currentgame.getQuestions().size(); i++) {
if (currentgame.getQuestions().get(i).getQuesti... |
71f71a73-0cd3-455f-9688-34bc6cea2a54 | 6 | public void pickUpItem() {
float eps = (float) 1e-01;
float n = player.getTaille();
if((Math.abs(player.getY() - getY()) - (getHeight()/2 + player.getTaille()/2)) <eps){
float x_gauche = player.getX() - n / 2;
float x_droite = player.getX() + n / 2;
float p_gauche = getX() - getWidth() / 2;
float p_d... |
1a332b66-c5b5-462a-8358-fb82ec8c502a | 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 Prioridade)) {
return false;
}
Prioridade other = (Prioridade) object;
if ((this.getId() == null && other.getId... |
c8f48def-b10e-488d-bcbb-eb24654cba7d | 9 | static final boolean method2935(byte b, int i, int i_0_) {
anInt7520++;
if (i_0_ >= 1000 && (i ^ 0xffffffff) > -1001) {
return true;
}
if (i_0_ < 1000 && (i ^ 0xffffffff) > -1001) {
if (Node_Sub27.method2699(18, i)) {
return true;
}
if (Node_Sub27.method2699(18, i_0_)) {
return false;
}
... |
3cc8230a-f9f4-49a8-ae05-6b2100b965b5 | 8 | public boolean isSamePath(Room r1, Room r2) {
if (r1.getCenterX() == start.x && r1.getCenterY() == start.y) {
if (r2.getCenterX() == end.x && r2.getCenterY() == end.y)
return true;
} else if (r2.getCenterX() == start.x && r2.getCenterY() == start.y) {
if (r1.getCenterX() == end.x && r1.getCenterY() == end... |
95d7bc7a-3a36-40fc-afac-064bd04769f2 | 6 | public static Date strtotime(String input) {
if (input.startsWith("[") || input.startsWith("\"")) {
input = Functions.substr(input,1);
}
if (input.endsWith("[") || input.startsWith("\"")) {
input = Functions.substr(input,0,-1);
}
for (Matcher matcher : matchers) {
D... |
a4b155a8-f6ee-4110-8df9-63b1946f5fac | 3 | public static void main(String[] args) {
ArgParserTest test = new ArgParserTest();
ArgHolder<Boolean> bh = new ArgHolder<Boolean>(Boolean.class);
boolean[] b3 = new boolean[3];
ArgHolder<Character> ch = new ArgHolder<Character>(Character.class);
char[] c3 = new char[3];
ArgHolder<Integer> i... |
cbba1765-3302-4b06-aee3-4d69cc1c72ec | 9 | public void LoadContent() {
gameFrame.getContentPane().add(ContinueButton);
random1 = (int) (Math.random()*4 + 1);
do {
random2 = (int) (Math.random()*4 + 1);
} while (random1 == random2);
switch (random1) {
case 1:
disp1 = sora;
... |
03d5d70d-5c3e-4399-8d8d-2b7d64ba7034 | 5 | public AIConnection[] getListInTurnOrderAndMoveToNextTurn(){
// TODO: Dead players are currently not purged anymore. Verify that works...
// purgeDeadPlayersFromRing();
// TODO: build in check here to skip over passing players
// TODO: test this code
while(true){
currentPlayer = currentPlayer.next;
if(c... |
ee7fff71-5822-4dc8-a7aa-48ea34c1208a | 9 | private static int search(int[] table, int value)
{
int index = 0;
if (table[index + 32] <= value) {
index += 32;
}
if (table[index + 16] <= value) {
index += 16;
}
if (table[index ... |
f88621d6-28c5-4237-8e06-eadd6469dbf6 | 5 | @Override
public Roleschool addRoleFromGson(String json, long id) {
Roleschool role = null;
if (json.contains("Teacher")) {
role = gson.fromJson(json, Teacher.class);
}
if (json.contains("Student")) {
role = gson.fromJson(json, Student.class);
}
... |
135955aa-969e-4914-bd20-279bbc0d9c8a | 2 | @Override
public String toString() {
String name = getName();
String append = "";
if(name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Long" + append + ": " + value;
} |
3f2e16a9-83a6-4641-acad-6c7704e89cdf | 4 | public void PassengersOnBoarding(BusStop busStop,OutputFile screen)
{
//set the current bus stop
currentBusStop = busStop;
//set the average persons for the bus stop
busStop.SetAverageNumberOfPersons();
//set the average person wait time
busStop.SetAveragePersonsWaitTime(this... |
6b790839-84a6-4896-af35-9ba4920ab414 | 8 | public void play() {
System.out.println("Starting the game...");
for (double gameNumber = 0; gameNumber < mGames; gameNumber++) {
double x1 = mRandom.nextTrueDouble();
double x2 = mRandom.nextTrueDouble();
System.out.println("X1=" + x1 + "\nX2=" + x2);
for... |
ae95c3ea-34f7-48bc-8dad-ea13188b4eaa | 3 | public static Node treeDelete(Node root,Node z){
if(z.left == null){
root = transplant(root,z,z.right);
}
else if(z.right == null){
root = transplant(root,z,z.left);
}
else{
Node y = minimum(z.right);
if( y.p != z){
root = transplant(root,y,y.right);
y.right = z.right;
y.right.p = y;... |
6e915bf0-f1c3-4324-bea5-71c44c4429c3 | 0 | public String toString(){
return Integer.toString(value) + "(" + Integer.toString(id) + ")";
} |
f860acd9-6467-479f-b57f-8421294492ce | 4 | public void shift(int base_position){
int[] z = findZ(base_position);
System.out.println(String.format("z1, z2:%3d, %3d", z[0], z[1]));
System.out.println("Before shift:");this.print();
// (z[0] , base_position-1] 区间全部左移
for (int i = z[0]+1; i != base_position; ++i){
... |
6721a2ee-339b-429e-b29c-370e7fa709c3 | 5 | public static int signingCost(Application app) {
//
// TODO: Signing cost is based on transport factors, attraction, no.
// already employed, etc. Implement all of that.
int transport = 0, incentive = 0, guildFees = 0 ;
guildFees += Background.HIRE_COSTS[app.position.standing] ;
if... |
eb4cedad-7052-4178-bf65-4806087e095e | 4 | @Test
public void testReleasePortNumberRunning() {
LOGGER.log(Level.INFO, "----- STARTING TEST testReleasePortNumberRunning -----");
try {
server1.startThread();
} catch (IOException | ServerSocketCloseException | FeatureNotUsedException e) {
exception = true;
... |
88caee56-1beb-46e3-83f4-bf36e1c1040d | 8 | public void render(Graphics g) {
g.drawImage(image, map.mapXOffset + mapX, map.mapYOffset + mapY, null);
if (owned) { //if owned, a blue rectangle appears around it on sides where there is unowned land
g.setColor(Color.RED);
Point listPoint = map.getListLocation(this);
if (!map.tileIsOwned(listPoint... |
fa955434-b90b-4e2f-a50e-329511c173c4 | 5 | public final void CompleteTrade() {
for (final IItem item : exchangeItems) {
byte flag = item.getFlag();
if (ItemFlag.KARMA_EQ.check(flag)) {
item.setFlag((byte) (flag - ItemFlag.KARMA_EQ.getValue()));
} else if (ItemFlag.KARMA_USE.check(flag)) {
item.setFlag((byte) (flag - ItemFlag.KARMA_USE.getVa... |
1b1925b4-466f-4f6f-b2b7-ddbd94412eab | 0 | private void dummy() {
} |
4e65a44f-44ea-43cc-8696-94b41b38dffc | 3 | private static void sort(int[] array) {
for (int i = 0; i < array.length; i++) {
for (int j = i; j < array.length; j++) {
if (array[j] > array[i]) {
array[j] = array[i] ^ array[j];
array[i] = array[i] ^ array[j];
array[j] = ... |
2e1ff6b3-a677-4689-9608-89afbde586da | 6 | public int verschilInMaanden(Datum d) {
int verschilInJaren = this.verschilInJaren(d);
if (this.kleinerDan(d) && this.getJaar() == d.getJaar()) {
int verschilMaanden = d.getMaand() - this.getMaand();
return verschilInJaren * 12 + verschilMaanden;
}
if (this.kleinerDan(d)) {
int overschotMaanden = 12 - ... |
c9c6a38d-a594-4d7a-a7fc-09c27a7eee53 | 0 | public void addDataSet(DataSet set)
{
this.datasets.add(set);
} |
65ece679-2669-40fd-994d-066a70531a7f | 8 | public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
String header_guide =rpc.Helper.getIncludeGuide(rpc.Context.Get().getCurrentPackage(), rpc.Helper.PathType.eParamsHeader);
stringBuffer.append(TEXT_1);
stringBuffer.append(header_guide);
stringBuffer.... |
5e29d6a6-6075-4a31-bbec-ad59546700e2 | 4 | Map(String name, Tile[][] map) throws MapNotRectangularException {
//check if array is rectangular
{
int x = map.length;
int y = map[0].length;
int ytemp;
for(Tile[] array : map){
ytemp = array.length;
if(y != ytemp){
... |
2814e13e-598e-4aa4-b435-012e47d0a3b4 | 0 | @Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} |
ecd4b67f-abc6-4988-b2f8-bc7a93ee68aa | 5 | final int[] method3042(int i, int i_75_) {
anInt9143++;
if (i_75_ != 255)
aClass348_Sub42_Sub12_9144 = null;
int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i);
if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) {
int[] is_76_ = this.method3048((aBoolean9147
? C... |
806bccd4-ffe8-4588-8be8-a20fbc3573a4 | 5 | @SuppressWarnings("unchecked")
public static JSONObject executeShScript(String cmd, JSONObject jsonResp){
log.info("starting shell script execution ... :" + cmd);
try {
Process process = Runtime.getRuntime().exec(cmd);
String outStr = "", s = "";
BufferedReader br = new BufferedReader(new In... |
e78a7bbd-e880-4588-bd1c-c314542ae9f2 | 4 | public void update(float delta) {
setX(getX() + direction.x * delta);
setY(getY() + direction.y * delta);
animationTime += delta;
setRegion(direction.x < 0 ? left.getKeyFrame(animationTime) : direction.x > 0 ? right.getKeyFrame(animationTime) : direction.y < 0 ? down.getKeyFrame(animationTime) : direction.y > ... |
cbc1c657-13e3-4b2d-81a7-9a5176d18e77 | 2 | private static void loadWindowOptions() {
File inputFile = new File("windows.conf");
if (!inputFile.exists()) {
return;
}
try {
window_props.load(new FileInputStream(inputFile));
} catch (IOException e) {
System.out.println(e);
}
} |
11d0b577-a45a-43ae-999b-3be0bdf7727b | 9 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
Attribute att;
Attribute attNew;
Vector allLabels;
Enumeration enm;
int i;
FastVector values;
FastVector atts;
Instances instNew;
super.setInputFormat(instanceInfo);
m_AttIndex.setUpper(instanceInf... |
bd0f8d68-1a61-4d14-b2ea-8ad39137079b | 5 | private SeedMenuItem()
{
super("From seed");
setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK));
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)... |
7384cf1c-d161-41b0-b772-aa98b01217b1 | 7 | static void run(int number) {
try {
System.out.println("================================================");
DetailsLogger.startNewLog(detailsLogPrefix + "." + number + ".xml");
DetailsLogger.logParams(prop);
Individual sampleIndividual = new IntegerIndividual(we... |
07cfbb57-46ab-40c4-9bb2-f8bef503c715 | 3 | public boolean equals(Vari vertailtava)
{
return punainen == vertailtava.punainen() &&
vihrea == vertailtava.vihrea() &&
sininen == vertailtava.sininen() &&
peittavyys == vertailtava.peittavyys();
} |
2babed4d-efce-48c4-9beb-0b7fbfe7deb6 | 6 | @Override
public Ingredient retrieveIngredient(String name) throws DataStoreException{
name = name.toLowerCase();
if( isIngredientCacheValid ){
for ( Ingredient ingredient : ingredientCache ) {
if( ingredient.getSingular().equals("name")){
return ing... |
58b1ff05-2196-4103-8841-480af296777d | 5 | public String getActualSql(Object[] args) {
String[] tableNames = null;
String sql;
if (genericIndexes != null) {
for (Integer index : genericIndexes) {
if (index != null) {
Object arg = args[index];
if (arg != null) {
tableNames = (String[]) ArrayHelper.add(tableNames, arg.toString());
... |
3e5caa48-bfa8-4ca8-84f7-a79c0bc86317 | 7 | public FeatureVector predictExtract(GuideDecision decision) throws MaltChainedException {
if (decision instanceof SingleDecision) {
throw new GuideException("A branched decision model expect more than one decisions. ");
}
featureModel.update();
final SingleDecision singleDecision = ((MultipleDecision)decisio... |
2cee25e7-83ad-4b73-98d5-ef884606e736 | 1 | private double traverseCost(Node node, Node newNode, Agent agent) {
if (agent == null) { // default agent
Location loc1 = node.location, loc2 = newNode.location;
int dx = Math.abs(loc1.x - loc2.x), dy = Math.abs(loc1.y - loc2.y);
return costs[grid[newNode.location.x][newNode.location.y]] + 0.1
* (dx + d... |
8dfc5b80-57c0-4569-bbe9-e85dce126647 | 3 | public static Player getPlayer(String name) {
for (World world : worlds)
for (Player cyclePlayer : world.getPlayers())
if (cyclePlayer.getUsername().equalsIgnoreCase(name))
return cyclePlayer;
return null;
} |
c6d8e2d3-4dbc-40cb-a79d-c33a8e63cea9 | 4 | public void setREM(int REM) {
this.REM = REM;
if (REM==0)
CharInfo[15] = 0;
else if(REM==1)
CharInfo[15] = 1;
else if(REM==2)
CharInfo[15] = 2;
else if(REM==3)
CharInfo[15] = 3;
else
this.code.setValid(false);
} |
4d341d2c-72a9-4b28-b1a3-002b88a02f91 | 5 | @SuppressWarnings("unchecked")
public FenetreFichier(final Portail p1, final Fichier fileModif,
final Groupe gp) {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 379, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
... |
362f920d-e1ff-4da2-af0f-959c03dbec8d | 5 | public String preferredGender() {
final boolean male = actor.traits.male() ;
if (actor.traits.hasTrait(ORIENTATION, "Heterosexual")) {
return male ? "Female" : "Male" ;
}
if (actor.traits.hasTrait(ORIENTATION, "Homosexual")) {
return male ? "Male" : "Female" ;
}
return Rand.yes() ? "... |
ab314d21-a777-4fef-879d-77049e5d60f7 | 0 | public synchronized void release() {
state = STATE_RELEASED;
} |
3241ac73-24d1-4f82-ab3f-0ad18ac71f1c | 6 | public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
switch(key) {
case KeyEvent.VK_CONTROL:
fire();
break;
case KeyEvent.VK_LEFT :
bL = false;
break;
case KeyEvent.VK_UP :
bU = false;
break;
case KeyEvent.VK_RIGHT :
bR = false;
break;
case KeyEvent.VK_DOWN :
bD = fal... |
65e4e444-9859-4ba5-8fed-98f02427675f | 2 | public Rol buscarRol (String name){
Rol rol=null;
ArrayList<Rol> dbRol = tablaRoles();
for (Rol r : dbRol){
if(r.getNombre().equals(name)){
rol = r;
}
}
return rol;
} |
e8860087-a3ea-4d21-9e24-e1003473157a | 4 | protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String uniId = request.getParameter("uni_id");
HttpSession session = request.getSession(true);
session.setAttribute("uni_id", uniId);
UniDatabaseManager u... |
d2d5b058-a23a-43a4-b395-b0db4593193c | 5 | public int binarySearchTail (ArrayList<String> word, String key,int first, int last){
int mid = first + ((last-first)/2);
if (word.size() == 0){
return 0;
}
if (first>last){
return mid;
}
if (key.equals(word.get(mid))){
return mid;
... |
4be76ec5-2012-4c82-8ad5-82ee3a2a3866 | 5 | public IVPBoolean lessThanOrEqualTo(IVPNumber num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TY... |
35578814-191b-45b3-bf53-5f60ed0ecb50 | 8 | private void notifyConnectionClosed() {
if(_dataModelConnection != null){
// hierdurch werden laufende Operationen in der 2. Verbindung unterbrochen, die die folgenden Aktionen blockieren können.
// Deswegen am Anfang der Methode ausführen.
_dataModelConnection.disconnect(false, "");
}
List<DavConnection... |
0b2b6eef-07ed-499f-965b-e8021430d28f | 0 | @Override
public PermissionType getType() {
return PermissionType.CONSOLE;
} |
a7e400e4-23ad-4470-99ef-6eb2c66a40e8 | 8 | public Polynomial add(Polynomial P2) {
PolynomialImp result=new PolynomialImp("");
for(Term t1:this.terms){
boolean found=false;
for(Term t2:P2){
//sum if the second term is equal to the term in the first one, break
if(t1.getExponent()==t2.getExponent()){
found=true;
TermImp newTerm = new Te... |
3892418c-b1d4-4316-8081-4632b0df2542 | 9 | public static void readFiniteAutomataFromFile(Set<String> states, Set<String> alphabet, List<Element> transitionFunction, StringBuilder startState, Set<String> finalStates) {
try {
FileInputStream fstream = new FileInputStream("D:\\IdeaProjects\\Compilatoare\\src\\Files\\2.finiteAutomata.txt");
... |
24f05d6e-66a9-4cbe-8c93-adc873a74af3 | 5 | public DecisionTree parse(File f) throws FileNotFoundException, XMLStreamException {
DecisionTree result = null;
DecisionTreeNode root = null;
String[] labels = null;
//Open XML file
InputStream is = new FileInputStream(f);
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader... |
7b1f2211-45fc-468b-a3c8-4ca95d5af81c | 9 | @Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
world.render(0, 0);
for (GameObject item : items) {
item.render(gc, sbg, g);
}
player.render(gc, sbg, g);
cm.render(gc, sbg, g);
... |
b1c759ab-8286-4cf9-afdf-ac697c383b05 | 3 | @RequestMapping(value = "/{worldId}/{mapId}", method = RequestMethod.GET)
@ResponseBody
public List<Event> getEventsByWorldAndMap(@PathVariable int worldId, @PathVariable int mapId){
List<Event> result = new ArrayList<Event>();
List<Event> events = data.getEvents();
for(Event event : events) {
if(event.getWo... |
da05687e-9408-4da9-b880-b91c1f74a058 | 3 | private String FTP_response(String data)
{
Pattern p1 = Pattern.compile("USER");
Matcher m1 = p1.matcher(data);
Pattern p2 = Pattern.compile("PUT");
Matcher m2 = p2.matcher(data);
if (data == null)
return "500 Unknown command\r\n";
else if (m1.find())
return "220 Welcome.\r\n";
else if (m2.f... |
dfedb2e2-245a-4ac4-b03d-13807fcc1238 | 5 | private void checkMinMaxRelation(final Messager messager,
final AnnotationMirror mirror, final AnnotationValue valueMin,
final AnnotationValue valueMax) {
if (valueMin != null && valueMax != null) {
final SourcePosition srcPosition = mirror.getPosition();
final I... |
9bcb4f53-8865-4b0e-a0b8-79dcd5f64777 | 2 | public void configureForSave(OutlinerDocument doc, String protocolName, String currentDirectory) {
lazyInstantiate();
// adjust title
setDialogTitle("Save: " + protocolName);
// adjust approve button
setApproveButtonToolTipText("Save file as named");
// Set the Accessory state
setAccessory(saveAc... |
c821efed-ef2f-43b4-a5dc-91ae754167f5 | 9 | @Override
public void parseArgs(String[] args) {
if (args.length < 1) usage(null);
// Parse command line arguments
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-f")) {
// List in a file?
if ((i + 1) < args.length) fileName = args[++i];
else usage("Option '-f' without file argument"... |
4b97859c-9989-4f6d-b748-c578b56c1b89 | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
76809b1b-850d-4ab8-ab4f-d650f2b85983 | 9 | public Map<Integer, Double> getRankedTagList(int userID, int resID) {
Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>();
this.tagRecencies = new ArrayList<Map<Integer, Double>>();
// TODO: calculate your recommendations here and return the top-10 (=REC_LIMIT) tags with probability value
/... |
9c2f5c26-795d-4f77-83c6-7db6a7a80ad2 | 2 | public Sound get(String fileName, double volume, double pitch,
boolean shouldLoop) throws IOException {
fileName = filePath + fileName;
SoftReference<SoundData> ref = loaded.get(fileName);
SoundData data = ref == null ? null : ref.get();
if (data == null) {
loaded.remove(fileName);
data = new SoundData... |
7ae934da-86ad-4471-8ed6-b47ffbbfc75f | 2 | public boolean hasFinalState(State[] states, Automaton automaton) {
for (int k = 0; k < states.length; k++) {
if (automaton.isFinalState(states[k]))
return true;
}
return false;
} |
f137d90d-8532-441d-8f95-16a4500f942a | 7 | public void followBall() {
try {
if(!getMem().isObjVisible("ball")) {
turn(45);
return;
}
if(getMem().isObjVisible("ball")) {
ObjBall ball = getMem().getBall();
if((ball.getDirection() > 5.0) || (ball.getDirection() < -5.0)) {
turn(ball.getDirection() * (1 + (5 * getMem().getAmountOfS... |
da08a730-5b68-4bbd-8eb2-e8738fc28a0f | 7 | public void draw() {
int leftBound = (int) Math.floor(GLGuru.getXDisplacement() / Object.TILE_SIZE);
int rightBound = (int) Math.ceil((GLGuru.getXDisplacement() + ChristmasCrashers.getWindowWidth()) / Object.TILE_SIZE);
int bottomBound = (int) Math.floor(GLGuru.getYDisplacement() / Object.TILE_SIZE);
int topBou... |
0b66d43a-d2e1-489e-8b1d-81ae45f41de7 | 4 | public static void main(String[] args) {
if (args.length == 0 || (args.length == 1 && args[0].equals("-i"))) {
Runnable task = new CalculatorInteractive();
task.run();
} else if (args.length == 1) {
Runnable task = new CalculatorBatch(new File(args[0]));
task.run();
}
} |
b6929bc6-7d7c-4934-839b-1b274579fb3b | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof CoachCarriage))
return false;
CoachCarriage other = (CoachCarriage) obj;
if (coachNumber != other.coachNumber)
return false;
return true;
} |
d67e6ba8-bce0-49ae-8edb-d7d32e557f65 | 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 Departamento)) {
return false;
}
Departamento other = (Departamento) object;
if ((this.idDepartamento == null &... |
cacaf9da-e501-43d3-a0bc-9657236a9a50 | 0 | public void setMediator(Mediator mediator) {
this.mediator = mediator;
} |
c32186e9-ffc1-4323-8772-54f11df88a80 | 0 | public static void init(String username, String interfaceName)
{
instance = new ClientFinder(username, interfaceName);
} |
4428a1a5-62b4-4382-bdf3-2168e425844a | 5 | public static String[] sort(String[] a, int W) {
int N = a.length;
int R = 256; // extend ASCII alphabet size
String[] aux = new String[N];
for (int d = W-1; d >= 0; d--) {
// sort by key-indexed counting on dth character
// compute frequency counts
... |
21b59135-3afc-4140-b137-5e9c778051ad | 1 | protected void cleanUp() {
// signal to unpause
setPaused(false);
// close the mixer (stops any running sounds)
Mixer mixer = AudioSystem.getMixer(null);
if (mixer.isOpen()) {
mixer.close();
}
} |
fe5e63ef-5a6a-412b-a3c7-c83c40a4837c | 9 | @Override
public int[] getWindowIndices(int idx) {
Date beginning = getWindowBounds(idx)[0];
Date end = getWindowBounds(idx)[1];
int first = -1;
int last = -1;
if (current.get(0).getStart().after(end) || current.get(current.size() - 1).getStart().before(beginning))
... |
c679addd-cb39-4484-b8eb-2e2c7f7d5082 | 3 | public static void recursiveZipDirectory(File sourceFolder, ZipOutputStream zipStream) throws IOException {
String[] dirList = sourceFolder.list();
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
for (int i = 0; i < dirList.length; i++) {
File f = new File(sourceFolder, dirList[i]);
if (f.isDirectory... |
e00cbd82-a074-481f-8a40-5862a98db111 | 1 | public static boolean transform(InstructionContainer ic,
StructuredBlock last) {
return transformNormal(ic, last) || transformJikesString(ic, last);
} |
ae6990c7-b0a7-4314-96cc-f039c3aebbb4 | 5 | private void setupUI() {
/* Creates a draw panel that has a background, we do all our drawing on here */ //http://stackoverflow.com/questions/10961023/move-a-jlabel-to-front
drawPanel = new DrawPanel();
drawPanel.setLayout(null);
try {
// Pretty much the cleanest way I've seen this done...
drawPanel.se... |
822db542-5be7-4518-b032-3ddb4a9d206a | 0 | @Override
public void dec(Integer... a) {
// TODO Auto-generated method stub
} |
72584133-0bfd-4938-9cf4-20fb5ce742eb | 5 | public boolean isSyncMark(int headerstring, int syncmode, int word)
{
boolean sync = false;
if (syncmode == INITIAL_SYNC)
{
//sync = ((headerstring & 0xFFF00000) == 0xFFF00000);
sync = ((headerstring & 0xFFE00000) == 0xFFE00000); // SZD: MPEG 2.5
}
else
{
sync = ((headerstring & 0xFFF80C00) ==... |
d2d6bc85-f7e3-4989-8097-0b8e356bd0de | 1 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
int origen = this.cbxeorigen.getSelectedIndex();
int simbolo = this.cbxsimbolo.getSelectedIndex();
int destino = this.cbxedestino.getSelectedIndex();
if (this.rbbefinal.isSelec... |
afe4bcb2-85e9-457e-b360-1f6d551e5970 | 5 | static public boolean readBoolean(String strPrompt) {
do {
try {
String strBool = readLineFromConsole(strPrompt).toLowerCase();
if (strBool.equals("s") || strBool.equals("y")) {
return true;
} else if (strBool.equals("n")) {
... |
df365e59-a957-4588-8388-443c1e3d1a52 | 7 | public String extractConfigSudoku9(Map<String, String> allRequestParams){
Set<String> keys = allRequestParams.keySet();
String[][] orderedValues = new String[9][9];
for (String key: keys){
String value = allRequestParams.get(key);
//The strings are exp... |
5d147714-6750-47ea-ade7-edb2db44424b | 1 | public static int cal(int x){
if(x < 0){
return 0;
}else{
return x + cal(x);
}
} |
1c228e4a-410e-47ed-810f-585d19b7587d | 1 | @Override
public Response list() throws IOException {
if(currentUser != null) {
return new ListResponse(proxyCli.getCombinedFileList());
}
return new MessageResponse("You have to login first to perform this action!");
} |
847e4032-6279-4de0-8647-a370d3cc52ff | 0 | @Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "box_id")
public int getBoxId() {
return boxId;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.