method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cfb20f11-6ad0-40ae-a714-c57e020135f8 | 0 | public void setPINEncoding(ValueFormatType value) {
this.pinEncoding = value;
} |
8106bf5f-46e1-4640-a072-1ec00a658ae4 | 7 | public void update(float tslf)
{
x += xspeed * tslf;
if(x > 0)
{
x = 0;
xspeed *= -1;
} else if(x < -background.getWidth() + Main.width)
{
x = -background.getWidth() + Main.width;
xspeed *= -1;
}
for(int i = 0; i < buttons.length; i++)
{
if(buttons[i].update())
{
sound.play();
... |
a008805a-efd7-497b-83d8-8949ada18bb8 | 7 | MyFrame(int noOfGeometricObjects)
{
// creates a Frame that contains 8 rows and 8 columns of randomly picked, colored and sized shapes
super();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 400);
// central point to set number of geometric objects
//int noOfGeometricObjects = noOfItems... |
902b3686-75e5-4081-9c5b-90a37177beb8 | 1 | protected void threadStopped() {
SourceDataLine line = (SourceDataLine)localLine.get();
if (line != null) {
line.drain();
line.close();
}
} |
9e75ca41-9b2c-4c46-be99-deee74c85ad6 | 1 | public static ExchangeContext createLocalContext(Case CASE) {
PGridHost localHost = null;
PGridHost remoteHost = null;
RoutingTable localRT = null;
RoutingTable remoteRT = null;
try {
localHost = new PGridHost("127.0.0.1", 3000);
localHost.setUUID(hostUUI... |
c4b849e3-8297-4399-969c-c2d2251884fe | 0 | public static void main(String[] args) {
Primitives primitives = new Primitives();
System.out.println("Default values of primitives as fields in class");
System.out.println("boolean: " + primitives.aBoolean);
System.out.println("char: " + primitives.aChar);
System.out.println("by... |
851e272c-fb01-485d-bf63-f43fb8b5ae58 | 7 | @EventHandler
public void GhastHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Hunger.Dod... |
95f9c661-b1f1-4bfa-b4a3-355263908543 | 0 | @Test
public void validationDoubleWithIntegerPositiveTest() {
view.getTimeStepTextField().setText("5");
view.getTimeStepTextField().getFocusListeners()[0].focusLost(focusEvent);
assertTrue(view.getDrawButton().isEnabled());
} |
d973b647-2f6a-41aa-ae4d-ad5819f3bb55 | 0 | public void setCtrValorTotal(double ctrValorTotal) {
this.ctrValorTotal = ctrValorTotal;
} |
2eeb54f5-2f1f-48db-b109-3f066bd982b1 | 5 | public static boolean IsSquareThreatened (int SquareX, int SquareY, boolean WhiteMove, ChessPieceBase[][] TheBoard){
for (int a=0;a<8;a++){
for (int b=0;b<8;b++){
if (TheBoard[a][b].isWhite==(!WhiteMove)&&TheBoard[a][b].isValidMove(SquareX,SquareY,a,b)&& isUnblockedMove(SquareX,Squar... |
534bbc81-67f4-47b9-a007-ff3e4f0a4dd6 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.countries");
try {
Criteria criteria = new Criteria();
Country currCountry = (Country) request.getSessionAttribute(JSP_CURRE... |
b6ec4274-13fa-4b71-8fa9-bc57759f686c | 3 | public static long getMaxRectangleSum() {
int ROWS = m.length, COLS = m[0].length;
long[] comp = new long[ROWS];
long maxArea = 0;
for (int left = 0; left < COLS; left++) {
Arrays.fill(comp, 0);
for (int right = left; right < COLS; right++) {
for (int r = 0; r < ROWS; r++)
comp[r] += m[r][right];... |
093fcd5a-0207-42fe-bd1e-ff92410f5393 | 5 | @EventHandler
public void oreGinPistonPull(BlockPistonRetractEvent event)
{
MaterialData materialData = event.getBlock().getState().getData();
BlockFace blockFace;
Block movedBlock;
if (materialData instanceof PistonBaseMaterial)
{
blockFace = ((PistonBaseMaterial) materialData).getFacing();
movedBl... |
074ccb80-0e16-4cde-bf2e-afdd56b29790 | 6 | private int readFixnumBody(int nBytes, final boolean shouldBeNegative)
throws IOException {
if (trace == API_TRACE_DETAILED) {
debugNote("readFixnumBody isNegative=" + shouldBeNegative + " length=" + nBytes);
}
if (nBytes > 4) {
throw new ArithmeticException("Cannot fit " + nBytes + "... |
bc22e795-732a-4ecd-a054-f5aeca4f97f3 | 1 | public Page getPageArgument(Object[] args) {
if (pageIndex != -1) {
return (Page) args[pageIndex];
}
return null;
} |
fcbeff37-bbea-415e-a499-684a46a2590e | 9 | public void generateFileOperations(int noOfOperations,int numberOfNodes) throws IOException
{
File operationFile = new File("OpFile.txt");
//File operationFile = new File("op1.txt");
try
{
if(new File("OpFile.txt").exists())
... |
f4fa0480-a2aa-4994-8111-91cd95c63f4a | 0 | public FacOracleDAO getFacOracleDAO() {
return facOracleDAO;
} |
b1fd4c32-0851-4707-aaee-b64da399e867 | 0 | public TesterMainGUIMode(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
} |
c5b456f9-66fb-49ca-95fa-acba02f926b7 | 5 | private static double elimiCommon(int i, int j){
Set<Character> seen = new HashSet<Character>();
for(char c : Integer.toString(i).toCharArray()){
seen.add(c);
}
char common = '0';
for(char c : Integer.toString(j).toCharArray()){
if(c!='0' && seen.contains(c)){
common = c;
break;
}
}
if (c... |
1a880f04-1bae-4228-94cc-b221e1d343ef | 8 | public void run()
{
long currentTime = 0;
while(true)
{
try
{
sleep(20);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
currentTime = System.currentTimeMillis();
if(vizFlag && currentTime - vizTime > GlobalGameboard.vizualizationTime)
{
vizFlag = false... |
05021e78-81b7-410c-9f6d-d2e68de2adff | 6 | public Board( JPanel panel, int gameValue, int maxNumber){
try{
handler = new FileHandler("Logging.txt");
} catch (IOException e){
handler = new ConsoleHandler();
}
log.addHandler(handler);
this.panel = panel;
this.gameValue = gameValue;
this.maxNumber = maxNumber;
handwritting = null;
... |
9f7ce5a1-3a9e-40c9-9971-422de37e391e | 2 | public void setInputStream(final InputStream is) {
new Thread() {
public void run() {
BufferedReader bir = new BufferedReader(new InputStreamReader(is));
String s;
try {
while ((s = bir.readLine()) != null) {
final String final_s = s;
textArea.getDisplay().asyncExec(new Runnable() {
... |
01638f96-3b12-4666-897a-d18dd09f3fc1 | 3 | private void timeMove(double voltage, double seconds) {
long milis = (long)(seconds * 1000);
long time = System.currentTimeMillis();
while (System.currentTimeMillis() < time + milis) {
drive.GoForward(voltage);
if (System.currentTimeMillis() - time > 10)
try {
Thread.sleep(10);... |
9545ef31-880b-411c-bbb9-881c100c1f3e | 8 | public Map<Date, Double> toBill(Date registrationDate, String plan, int textCount, String options,
String payAsYouGoLevel, int callTime, String country) {
System.out.println("Starting billing for plan: " + plan + " texts counts: " + textCount + " call time: "
+ callTime);
System.out.println("Country: " + cou... |
550d7f88-c606-4e03-bcac-44d86361eb75 | 0 | public static void main(String[] args) {
EvenChecker.test(new _7_EvenGenerator());
} |
941f07ea-061f-402b-bf5e-5bd222f4793e | 3 | public Intersection findIntersect(Ray r) {
double a = r.getDirection().dot(r.getDirection());
double b = 2 * r.getDirection().dot(r.getOrigin().sub(center));
double c = r.getOrigin().sub(center).dot(r.getOrigin().sub(center))
- (radius * radius);
double f = Math.pow(b, 2) - 4 * a * c;
if (f < 0) {
retu... |
6435f52b-ce4b-4ff7-8d95-ab4f22b9dcf6 | 7 | public void mouseClicked(MouseEvent me)
{
if ((me.getModifiers() & MouseEvent.ALT_MASK) != 0)
return;
addUndo();
int x = me.getX()
/ (getTileSize() * getZoom() + (isDrawGridLines() ? 1 : 0));
int y = me.getY()
/ (getTileSize() * getZoom() + (isDraw... |
07065348-702f-4793-b090-a524cb8f772b | 8 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==radio_dij_mono || e.getSource()==radio_dij_bi) {
panel.remove(combine_space);
panel.remove(combine);
panel.repaint();
panel.validate();
} else if(e.getSource()==radio_dij_bis) {
panel.add(combine_space);
panel.add(combine);
... |
9ad217ed-b70d-4113-a7aa-44bd50092688 | 0 | @Override
public String getFileName() {
return fileName;
} |
98eef465-aa06-4830-a46c-aab215d7749c | 1 | public static void main(String args [])
{
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Gui window = new Gui();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
523a31ec-0c71-409c-b04a-232960e129d3 | 0 | @SuppressWarnings("rawtypes")
public static Set<Class> getAllInterfacesAsSet(Object instance) {
Assert.notNull(instance, "Instance must not be null");
return getAllInterfacesForClassAsSet(instance.getClass());
} |
5a26b4d9-7772-4f56-95dd-7eb90ab8e0ae | 7 | public boolean onlyHasSolution (){
int countWeapon =0;
int countPerson=0;
int countRoom =0;
for(Card c: seenCards){
switch (c.getType()){
case WEAPON : countWeapon++;
break;
case PERSON : countPerson++;
break;
... |
1546fd67-e463-4bc7-bb9d-ff3833fe9121 | 2 | public void unload() {
/*this.objective.unregister();
this.scoreboard.clearSlot(DisplaySlot.SIDEBAR);*/
try {
Bukkit.unloadWorld(this.worldName, false);
} catch (Exception e) {
e.printStackTrace();
}
try {
Bukkit.unloadWorld(this.world, false);
} catch (Exception e) {
e.printStackTrace();
... |
9c2767ee-ec6b-4f7f-88f1-0a87c6ed9de2 | 2 | public final TLParser.parse_return parse() throws RecognitionException {
TLParser.parse_return retval = new TLParser.parse_return();
retval.start = input.LT(1);
Object root_0 = null;
Token EOF2=null;
TLParser.block_return block1 = null;
Object EOF2_tree=null;
... |
6318d84e-2bdc-43ba-847d-01bcbd121c99 | 4 | public FindDialog(JFrame frame) {
super(frame);
String recipeDir = "";
opt = Options.getInstance();
if(opt.getProperty("optRecipe") != null)
recipeDir = opt.getProperty("optRecipe");
if(recipeDir.equalsIgnoreCase("") ) {
try {
recipeDir = SBStringUtils.getAppPath("recipes");
} catch (Unsupport... |
f20216be-3118-4201-96b5-2abaa4cdb248 | 8 | private void getDatabaseData(){
try
{
ArrayList<Activity> actList = factory.getActivities();
for(Activity activity : actList){
activities.put(activity.getKey(), activity);
}
plans = factory.getWorkoutPlansForUser(gym.loggedIn);
for(WorkoutPlan plan : plans){
ArrayList<PlanElement> planEle... |
0035e8de-c3f2-4f8f-9db8-8290c22a4441 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.direction");
try {
Criteria criteria = new Criteria();
Direction currDirection = (Direction) request.getSessionAttribute(JSP... |
533db0ca-e5c8-47ec-bc4b-05c7f5fee4ca | 5 | @Override
public void emettre() throws InformationNonConforme {
double bruit;
double puissanceBruit = 0; // = puissance de bruit
float puissanceSignal = 0.0f; // Ps= (1/N) Sum(Sn²) de n=0 à N-1
float a1, a2; // variables aléatoires uniformément distribuées dans
// [0,1[
float sum = 0;
Float[] tabFloa... |
95e36435-a811-4600-aa85-fe1325bf7e6a | 4 | public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... |
10f7ef66-9f73-4564-8293-9d2f3e07f510 | 3 | public void run() {
System.out.println(this.getName() + " started!");
while (running) {
// poll the nodes
for (Node node : nodes)
node.poll();
//System.out.println(getName() + ": " + getResourceManager().queueSize());
// sleep
try {
Thread.sleep(pollSleep);
} catch (InterruptedExce... |
4f96a496-5828-4f20-9e4e-635f3e6f64f7 | 0 | public Cell[] getNeighbors() {
return neighbors;
} |
831fc170-30f9-4823-b29b-f19b8d4791f1 | 1 | @Override
public FoodObject lookUpFood(String name) {
if (cachedFoodObjectMap.containsKey(name)) {
return cachedFoodObjectMap.get(name);
//TODO: fall back to db
}
else return null;
} |
328d245b-47ab-4849-9fe7-68b221013125 | 0 | public PassiveActivities getPassiveActivity() {
return passiveActivity;
} |
612d9384-0544-4b91-b71f-9b00ac21afaa | 1 | private void tallennaPelaajanTilanne(int tasonNumero) {
try {
Tiedostonkirjoittaja kirjoittaja = new Tiedostonkirjoittaja();
TallennuksenKasittelija kasittelija =
new TallennuksenKasittelija(tasonNumero);
kirjoittaja.kirjoitaTiedosto(
"... |
5063d1e0-f936-4646-b14c-f52f52ef1473 | 5 | public int countEntries(String name, boolean isXML){
int count=0;
if (!isXML) {
try{
FileReader fr = new FileReader(name);
BufferedReader br = new BufferedReader(fr);
StreamTokenizer st = new StreamTokenizer(br);
st.whitespaceChars(',', ',');
while(st... |
63351fed-2bea-4894-86e2-b2c0b4acdba4 | 1 | public void testParseMutableDateTime_simple() {
MutableDateTime expect = null;
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
assertEquals(expect, g.parseMutableDateTime("2004-06-09T10:20:30Z"));
try {
g.parseMutableDateTime("ABC");
fail... |
06b62e79-4cc8-4db5-8adc-f2ea7f7031eb | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PageResponse<?>)) {
return false;
}
PageResponse<?> that = (PageResponse<?>) obj;
boolean totalEqual = this.total == that.total;
boolean contentEqual = this.content.equals(that.content);
boole... |
52483292-912d-4bca-93f4-e2743eac3291 | 8 | @SuppressWarnings("resource")
public int getEmptySeats(String cabinClass, int fsID, int cap) {
int free = 0;
try {
Connection conn = DBConnection.getConnection();
String sqlStr = "select * from booking b where b.fsID=?";
PreparedStatement pstmt = conn.prepareStatement(sqlStr);
pstmt.se... |
1e415566-091d-4d9b-af11-304c949790fc | 0 | public void setOffset(int xOffset, int yOffset) {
this.xOffset = xOffset;
this.yOffset = yOffset;
} |
0d52e394-8a3e-46de-9ed8-eb8e84f5630d | 3 | public int maxProfitRec(int[] prices, int s, int e, int [] maxmin) {
if (s >= e) {
Arrays.fill(maxmin, prices[s]);
return 0;
}
if (e - s == 1) {
int diff = prices[e] - prices[s];
maxmin[0] = Math.max(prices[s], prices[e]);
maxmin[1] = Math.min(prices[s], pr... |
15117016-d77b-4d6c-8c0d-fde57c459b0d | 1 | @Override
public boolean execute() {
Boolean val = true;
try {
this.document.saveToFile(filePath);
} catch (Exception ex) {
ex.printStackTrace();
val = false;
}
return val;
} |
9fb7739a-7501-4b92-b9d2-33aeeae74b53 | 4 | @EventHandler(priority = EventPriority.NORMAL)
public void setFormatChat(final PlayerLoginEvent e) {
if(e.getPlayer().hasPermission("bungeesuite.*")){
PermissionsManager.addAllPermissions(e.getPlayer());
}else if(e.getPlayer().hasPermission("bungeesuite.admin")){
PermissionsManager.addAdminPermissions(e.getP... |
15892325-459d-496f-9da8-712e944524dd | 7 | public static final void updateMultiListFile(String filename, final Map<String, List<String>> lists)
{
final StringBuilder str=new StringBuilder("");
for(final String ml : lists.keySet())
{
final List<String> subList=lists.get(ml);
str.append(ml+"\r\n");
if(subList!=null)
{
for(int v=0;v<subList.... |
b2cefc8d-97ac-4b7b-aef6-6688a34ff9bc | 8 | @Override
public void expand(int grabber, Point endMove, int canvasWidth, int canvasHeight)
{
if(((endMove.getX()) > 0) // for X
&& ((endMove.getY()) > 0) // for Y
&& ((endMove.getX()) < canvasWidth)
&& ((endMove.getY()) < canvasHeight)
)
{
Point startMove = new Point();
switch (grab... |
680e1dd4-6e63-465a-ad71-9f514868b1e3 | 8 | private void load() {
Set<Object> pinnedBlocks = new HashSet<Object>();
try {
Map<String, CollectionNameMeta> map = new HashMap<String, CollectionNameMeta>();
Map<String, List<ColumnNameMeta>> collectionColumnMap = new HashMap<String, List<ColumnNameMeta>>();
BlockPtr ptr = new SingleBlockPtr((byte)... |
fe624fd0-eef0-46f2-85b7-da0e21a11175 | 5 | private void avoidBullet() {
InfoDetail bullet = this.findClosestObject(this.bullets_in_radius);
this.evading = true;
if(bullet != null) {
if(this.evade_from == null || bullet.getDirection() != this.evade_from.getDirection()) {
int rdirx = (this.randomizer.next... |
9ffa69a6-90a2-4360-b673-7dfbfb591baa | 0 | public static String convertClassNameToResourcePath(String className) {
Assert.notNull(className, "Class name must not be null");
return className.replace('.', '/');
} |
0fa1498f-05e5-412a-a51a-86a20d5ac245 | 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... |
b2e8ac75-8d9f-4497-85d5-fd762cd35e53 | 9 | protected Class findClass(String name) throws ClassNotFoundException {
byte[] classfile;
try {
if (source != null) {
if (translator != null)
translator.onLoad(source, name);
try {
classfile = source.get(name).toBytecode... |
e64bfea7-4499-4fa9-8196-af83e3197c08 | 2 | public void readFile() throws FileNotFoundException {
FileReader fileReader = new FileReader(file);
BufferedReader buffReader = new BufferedReader(fileReader);
String thisLine = "";
try {
while((thisLine = buffReader.readLine()) != null) {
// TODO Insert Logger
// Reads Current Line and calls read... |
bc3e6971-a4c3-4376-b767-e931a91ca50a | 8 | private String prepareConfigString(String configString)
{
int lastLine = 0;
int headerLine = 0;
String[] lines = configString.split("\n");
StringBuilder config = new StringBuilder("");
for (String line : lines)
{
if (line.startsWith(this.getPluginName() + "_COMMENT"))
{
String comment = "#" ... |
ead02f4f-9932-4357-a43d-282c3c40b8cb | 6 | public void sim_wait(Sim_event ev) {
if (!Sim_system.running()) {
return;
}
do {
Sim_system.wait(me, Sim_system.SIM_ANY);
Sim_system.paused();
restart.p();
if (!Sim_system.running()) return;
} while (evbuf==null);
if ((ev != null) && (evbuf != null)) {
ev.copy(evb... |
7fb3aa94-deb1-43a7-a56c-6b414750c395 | 5 | public void runThreads() {
ExecutorService es = Executors.newFixedThreadPool(10);
List<Future<?>> futures = new ArrayList<>(NUM_THREADS);
System.out.println("Amount before: " + bank.getTotalAmount());
for (int i = 0; i < NUM_THREADS; ++i) {
Runnable task;
task =... |
fb4674b2-305c-4d38-a4bf-0012c5a97fd7 | 8 | public Type stringToType(String trigger) {
trigger = trigger.toLowerCase();
Type type = null;
if (trigger.equals("soul"))
type = Type.SOUL;
else if (trigger.equals("2soul"))
type = Type.DOUBLE_SOUL;
else if (trigger.equals("bounce"))
type = Type.RETURN;
else if (trigger.equals("stock"))
type = T... |
c453b64b-8395-45ef-a87c-d627d9ad6f1e | 0 | public void mouseExited(MouseEvent e) {
} |
90e8e8f5-3502-42ef-aa3f-49998d8d59b6 | 2 | public static AvailableUnavailableType valOf(Character val) throws Exception {
if (val.equals(Available.getVal())) {
return Available;
} else if (val.equals(Unavailable.getVal())) {
return Unavailable;
}
throw new Exception("Kode tidak terdaftar");
} |
5e13bffd-a309-4e76-b13b-ff6aafe78299 | 8 | public int maxProfit(int[] prices)
{
int k = 4;
if (prices.length == 0) {
return 0;
}
if (k == 0) {
return 0;
}
k = Math.min(k, prices.length);
int[] bestTrades = new int[k];
for (int i = 0; i < bestTr... |
1c947316-a6d2-487e-a4be-0755358cb9b7 | 5 | @SuppressWarnings("unused")
static MediaLocator createMediaLocator(String url) {
MediaLocator ml;
if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
return ml;
if (url.startsWith(File.separator)) {
if ((ml = new MediaLocator("file:" + url)) != null)
return m... |
f63c6361-9073-4d95-94db-ff120a4726fe | 6 | private int[] findRandomEmptyCoordinates(IGameMap game) {
ArrayList<int[]> empty_fields = new ArrayList<int[]>();
game.foreachField((x, y, type) -> {
if (type == FieldType.EMPTY) {
boolean field_is_free = true;
for (Item current_item : game.getItemsOnMap()) {
if (current_item.get... |
434d924e-c7a1-4169-bd2b-073d17d6a50a | 7 | public static void drawForm(Graphics2D g2, Form form) {
switch(form.getType()) {
case FREELINE:
Draws.drawFreeLine(g2, form);
break;
case LINE:
Draws.drawLine(g2, form);
break;
case POLYGON:
Draws... |
7bc9d262-ddf9-4798-a3c9-04bf10d62494 | 4 | public ArrayList<Auto> getAlleAutosDB() {
ArrayList<Auto> alleAutosDB = new ArrayList<Auto>();
try {
this.leesDatabase();
output = statement.executeQuery("SELECT * FROM auto");
while (output.next()){
int id = output.getInt("auto_id");
String kenteken = output.getString("kenteken");
String merk... |
bda4e382-435e-4515-8875-976a4196e3e6 | 9 | public Color getTileColor(int x, int y, int pixelSize){
float r = 0, g = 0, b = 0, n = 0;
for(int x2=x; x2<x+pixelSize; x2++){
for(int y2=y; y2<y+pixelSize; y2++){
if((x2 >= w) || (y2 > h)) break;
n++;
switch(level.fields[y][x]){
case dest: b += 1f; break;
case floor: r += 0.7f; g += 0.7f; ... |
c6994528-d1e8-4fbe-81ae-178df87d3758 | 0 | public void setScore(int score, int nbLigne){
this.setText("<html>Nombre Lignes : "+nbLigne+" <br><br>Score : "+score+" </html>");
} |
7f792d07-87b8-4da0-a3c3-85d65c73cd10 | 1 | @Override
public void actionPerformed(ActionEvent event) {
Undoable undoable = getTarget(Undoable.class);
if (undoable != null) {
undoable.getUndoManager().undo();
}
} |
cc95caca-29b0-4699-af88-f2374fecd52d | 2 | private void refreshList(ListProperty<NoteEntity> list) {
List<String> filenameList = readDir();
for (Iterator<String> it = filenameList.iterator(); it.hasNext();) {
NoteEntity e = readNoteEntity(basePath + "/" + it.next());
if (list.contains(e)) {
// Skip !
... |
d2c870e4-b2fe-414e-babc-a87dd6ba014e | 9 | private BufferedImage convertGreyscaleToArgb(byte[] data, BufferedImage bi)
{
// we use an optimised greyscale colour conversion, as with scanned
// greyscale/mono documents consisting of nothing but page-size
// images, using the ICC converter is perhaps 15 times slower than this
//... |
0caa5578-edf6-4743-914b-488774e7e188 | 4 | public boolean IsPrivate (String chatroom) {
ArrayList <String> privates = new ArrayList <String> ();
Player [] player = Bukkit.getServer().getOnlinePlayers();
for (int i = 0; i < player.length; i++) {
if (!privates.contains(config.getConfig().getString("Player."+player[i].getName()+".CR")))
if (config.get... |
14994867-2bf4-4fbc-a531-cb04a6f265e5 | 1 | private static byte[] toCstr(String str) {
byte[] result = new byte[str.length() + 1];
for (int i = 0; i < str.length(); i++) {
result[i] = (byte) str.charAt(i);
}
result[str.length()] = 0;
return result;
} |
d0861628-9ff2-44b8-9e58-11003b9007e2 | 9 | public boolean hasPublicDeviceIDType() {
switch (getDeviceIDType()) {
case 20:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 60:
case 70:
return true;
}
return false;
} |
5a8fdaa3-9e35-4975-a923-5dbb68fbdb2e | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0)
{
... |
af130c69-5666-4c14-949c-02d3fd4317d7 | 3 | public static void main(String args[]) {
try {
InputStream in = new Object().getClass().getResourceAsStream("/audio/slash.ogg");
ByteArrayOutputStream byteOut = new ByteArrayOutputStream(1024*256);
byteOut.reset();
byte copyBuffer[] = new byte[1024*4];
OggInputStream oggInput = new OggInputStream(in);
... |
4df792e6-a1b1-4670-a586-abfa8a28154f | 7 | private Color colorForChatType(int chatType) {
switch (chatType) {
case GLOBAL_TEXT:
return globalTextColor;
case SHOUT_TEXT:
return shoutTextColor;
case BUDDY_TEXT:
return buddyTextColor;
case PLAYER_INPUT:
... |
a89e39f7-27da-48d4-b686-2f44a52bcb6e | 0 | public boolean isConnected() {
return c != null;
} |
e1821049-58c5-4e07-8642-52911f8f6e9a | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
780d9dad-b59f-44dc-b07b-e921f8c61cc4 | 9 | public void start() {
this.connect();
long beginTime = System.currentTimeMillis();
if (this.connected) {
this.statusLog.logStatus("Worker connected!");
// Start receive and send threads
this.threadPool.execute(new SocketThread(this));
int runningCount = 0;
this.crawlCount = 0;
... |
896dbcae-4a86-4eed-af3d-f8910de7611b | 2 | @Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
if (!initSoundPlayed) {
initSoundPlayed = true;
}
/*if (InputChecker.isInputPressed(container, KeyBindings.P1_INPUT)) {
container.exit();
}*/
timer -= delta;
if (timer < 0) {
container.... |
cd4f51d8-9c5b-45a3-b359-cdfa695eb5c1 | 3 | public Vector3f getPoint( int i )
{
if ( i == 1 )
return point1;
if ( i == 2 )
return point2;
if ( i == 3 )
return point3;
return null;
} |
e72f49a1-0692-4e6f-8636-8c9725f7a6e8 | 2 | void compare(double p, int k, int n, double result) {
double prob = Binomial.get().pdf(p, k, n);
double abs = Math.abs(prob - result);
double diff = abs / Math.min(prob, result);
if ((abs > 1E-300) && (diff > 0.00000000001)) throw new RuntimeException("Relative difference:" + diff + "\t\t" + prob + " != " + re... |
d925678f-269d-465f-94cc-987acfed8299 | 8 | public static Proposition updateBinaryValue(Surrogate relation, Stella_Object self, Stella_Object value, Keyword updatemode) {
{ Object old$ClippingenabledP$000 = Logic.$CLIPPINGENABLEDp$.get();
try {
Native.setBooleanSpecial(Logic.$CLIPPINGENABLEDp$, true);
if (NamedDescription.functionDescr... |
e34b027f-6292-4115-bf30-53c1f0d0bfdc | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
0e225ec9-1cb0-43a2-b4da-be4490e2d11d | 4 | public int getSquareHeight() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getSquareHeight() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getSquareHeight() END");
}
return SQUARE_HEIGHT;
} |
134c9095-fab5-42e8-aee4-0a88e4b090b7 | 7 | protected void saveClusterer(String name, Clusterer clusterer,
Instances trainHeader, int[] ignoredAtts) {
File sFile = null;
boolean saveOK = true;
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
sFile = m_FileChooser.getSelectedFile... |
83073f2f-d320-4818-bb71-ed73be702d76 | 8 | public static S2CellId fromToken(String token) {
if (token == null) {
throw new NumberFormatException("Null string in S2CellId.fromToken");
}
if (token.length() == 0) {
throw new NumberFormatException("Empty string in S2CellId.fromToken");
}
if (token.length() > 16 || "X".equals(token)) ... |
f3133776-9f92-4ed7-be31-69ed9483a4d0 | 4 | public void writeNarc(String narcPath) throws IOException
{
HexOutputStream output = new HexOutputStream(new FileOutputStream(narcPath));
output.writeInt(1129464142);
output.writeInt(16842750);
int offset=output.getPosition();
output.writeInt(0);
output.writeShort((short)16);
output.writeShort((short)3);... |
412edd3a-4088-4708-872b-dc9a1eb76f5c | 0 | public void setCountry(String country) {
this.country = country;
} |
4a3bfef5-2333-4670-ad67-838f96a56cfd | 5 | @Override
public void delete(String dataBaseName, String tableName, Field entry) {
// get the array of col from load
XMLParser obj = new XMLParser();
ArrayList<Col>table=obj.load(dataBaseName, tableName);
//ArrayList<Col> table = intialize();
if (table == null)
return;
int indexOfConField = getIndexOfF... |
641f5578-4f2d-4e79-909f-67a5002c5e15 | 4 | private void setStartIndex() {
if(color.equals("green")){ startIndex = 4; safetyIndex = (startIndex-2); homeIndex = 65; distanceHome = 58;}
else if(color.equals("red")){ startIndex = 19; safetyIndex = (startIndex-2); homeIndex = 71; distanceHome = 58;}
else if(color.equals("blue")){ startIndex =... |
b3ff5081-8556-4238-b4e4-bb7bc84b34fe | 6 | @Test
public void completeRowOnlyRemovedWhenShapeHasStoppedMoving() {
testee = new Board(30, 10) {
@Override
public void addNewShape(Shape shape) {
super.addNewShape(new Square());
}
};
testee.addNewShapeAtRandom();
moveSidewaysThen... |
344828e2-eff5-481d-a112-4f4de3b4d306 | 1 | public boolean compa(String a){
boolean b= true;
String txt= a.replaceAll(" ", "");
if(txt.length()==0){
b=false;
error.setText("Los campos marcados con asteriscos son obligatorios");
}
return b;
} |
4c9c9d2c-856c-4b8d-8ce4-706b6f161de3 | 9 | public void startServer(){
//read network configuration
Configuration config;
try{
config = new PropertiesConfiguration("network.cfg");
} catch (ConfigurationException e) {
try{
config = new PropertiesConfiguration("network.cfg.default");
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.