method_id
stringlengths 36
36
| cyclomatic_complexity
int32 0
9
| method_text
stringlengths 14
410k
|
|---|---|---|
cbe30553-f5c5-47e1-9630-a891769075b8
| 9
|
public void paintComponent( Graphics g )
{
super.paintComponent( g ); // call the base class constructor
ArrayList<Double[]> points;// = new ArrayList<>();
points = getWalkway();
AffineTransform transform = new AffineTransform();
Double[] temp;
Graphics2D g2d = ( Graphics2D )g; // get graphics context
double flipY = scaleMeters[3];//- scaleMeters[1];
int drawNum = 0;
//GeneralPath newDraw = new GeneralPath();
if(!path.isEmpty())
path.clear();
g2d.translate(xOffset,yOffset);//(xOffset+300, -yOffset - 750);
path.add(new GeneralPath());
g2d.setColor(Color.BLACK);
for(int i = 0; i < points.size(); i++)
{
temp = points.get(i);
path.get(drawNum).moveTo((temp[0]-scaleMeters[0])*scaleFactor,(flipY - temp[1])*scaleFactor);
for(int j = 2; j < points.get(i).length;)
{
path.get(drawNum).lineTo((temp[j]-scaleMeters[0])*scaleFactor, (flipY-temp[j+1])*scaleFactor);
j+=2;
}
}
path.get(drawNum).closePath();
//g2d.setColor(Color.red);
g2d.draw(path.get(drawNum));
drawNum += 1;
path.add(new GeneralPath());
for(int i = 0 ; i < lines.allPolyPoints.size(); i++)
{
if(activeBone.equals(lines.uniqueID.get(i)))
{
g2d.setColor(Color.magenta);
g2d.setStroke(new BasicStroke(2));
}
else
g2d.setColor(setElevationColor(lines.elevation.get(i)));
for(int j = 0; j < lines.allPolyPoints.get(i).size(); j++)
{
temp = lines.allPolyPoints.get(i).get(j);
if(temp != null && lines.element.get(i) < detailLevel)
{
path.get(drawNum).moveTo((temp[0]-scaleMeters[0])*scaleFactor, (flipY - temp[1])*scaleFactor);
for(int k = 2; k < temp.length;)
{
path.get(drawNum).lineTo((temp[k]-scaleMeters[0])*scaleFactor , (flipY - temp[k+1])*scaleFactor);
k+=2;
}
}
}
g2d.draw(path.get(drawNum));
g2d.setStroke(new BasicStroke(1));
path.add(new GeneralPath());
drawNum += 1;
}
}
|
96c74fc1-83f6-4273-932c-dd075a339714
| 7
|
public static void inheritSuperclasses(Stella_Class renamed_Class) {
{ List parentclasses = List.newList();
Stella_Class.collectDirectSuperClasses(renamed_Class, parentclasses);
if (!renamed_Class.multipleParentsP()) {
{ Stella_Class onlyparent = ((Stella_Class)(parentclasses.first()));
if (onlyparent == null) {
return;
}
renamed_Class.classAllSuperClasses = Cons.cons(onlyparent, onlyparent.classAllSuperClasses);
return;
}
}
parentclasses = parentclasses.reverse();
{ Cons allsuperclasses = Stella.NIL;
Cons sublist = null;
{ Stella_Class parent = null;
Cons iter000 = parentclasses.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
parent = ((Stella_Class)(iter000.value));
sublist = Stella.NIL;
{ Stella_Class ancestor = null;
Cons iter001 = parent.classAllSuperClasses;
Cons collect000 = null;
for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
ancestor = ((Stella_Class)(iter001.value));
if (!allsuperclasses.memberP(ancestor)) {
if (collect000 == null) {
{
collect000 = Cons.cons(ancestor, Stella.NIL);
if (sublist == Stella.NIL) {
sublist = collect000;
}
else {
Cons.addConsToEndOfConsList(sublist, collect000);
}
}
}
else {
{
collect000.rest = Cons.cons(ancestor, Stella.NIL);
collect000 = collect000.rest;
}
}
}
}
}
sublist = Cons.cons(parent, sublist);
allsuperclasses = sublist.concatenate(allsuperclasses, Stella.NIL);
}
}
renamed_Class.classAllSuperClasses = allsuperclasses;
}
}
}
|
b3cf3f0a-8980-418f-9128-2b6001b182b6
| 3
|
public void addSecond(ImgDate date) {
String month = date.getMonth();
for(Object o : children) {
if(o instanceof DateTreeHelper) {
if(o.toString().equals(month)) {
((DateTreeHelper)o).children.add(date);
return;
}
}
}
DateTreeHelper dth = new DateTreeHelper(month);
add(dth);
dth.children.add(date);
}
|
d1161343-1adf-4626-808a-cb4d7a075480
| 0
|
public DBFiles (Collection<File> collection ){
this.dbFile = collection;
}
|
8ce2f0d9-3325-4fc8-9d11-49963f517e0e
| 5
|
public double getPropagationEnergyRoot(double energy_min, double energy_max) {
System.out.println("ENTERING BISECTION in getPropagationEnergyRoot...");
double energy = (energy_min + energy_max) / 2;
// double dprop = getPropagationValueLogDerivative(index,
// energy);
double dprop = getPropagationValueDerivative(energy);
while (Math.abs(dprop) > Function.CALC_TOLERANCE) {
System.out.println("BSF: " + dprop + "\tenergy_min: " + energy_min + "\tenergy: " + energy + "\tenergy_max: "
+ energy_max);
if (Math.abs(energy / (energy_min + energy_max) - 0.5) < Function.CALC_TOLERANCE) {
return energy;
}
// if (dprop * getPropagationValueLogDerivative(index,
// energy_min) >
// 0) {
if (dprop * getPropagationValueDerivative(energy_min) > 0) {
energy_min = energy;
// } else if (dprop *
// getPropagationValueLogDerivative(index,
// energy_max) > 0) {
} else if (dprop * getPropagationValueDerivative(energy_max) > 0) {
energy_max = energy;
}
if (energy == (energy_min + energy_max) / 2) {
return energy;
}
System.out.println("Energy difference = " + (energy - (energy_min + energy_max) / 2));
energy = (energy_min + energy_max) / 2;
// dprop = getPropagationValueLogDerivative(index,
// energy);
dprop = getPropagationValueDerivative(energy);
}
return energy;
}
|
3d63e8ff-f9a8-4209-a1d3-1bd115879e66
| 0
|
@Test
public void testSetTipoInteres() {
System.out.println("setTipoInteres");
float tipoInteres = 0.0F;
Cuenta instance = new Cuenta();
instance.setTipoInteres(tipoInteres);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
|
2757d2de-5f17-4662-8c73-d0e1cb320392
| 4
|
public static void main(String[] args) {
Parameters.load();
Profiler.initialize(false);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
// System.setProperty("awt.useSystemAAFontSettings","on");
// System.setProperty("swing.aatext", "true");
try {
GraphicsConfiguration gc = gd.getDefaultConfiguration();
Frame f = new Frame(gc);
f.setUndecorated(true);
f.setIgnoreRepaint(true);
Dimension dims = Toolkit.getDefaultToolkit().getScreenSize();
if (!Parameters.WINDOWED)
gd.setFullScreenWindow(f);
else {
f.setLocation(0, 0);
f.setSize(dims);
f.setVisible(true);
}
// if (gd.isDisplayChangeSupported()) {
// chooseBestDisplayMode(gd);
// }
if (!Parameters.WINDOWED)
gd.setDisplayMode(new DisplayMode(dims.width,dims.height,32,0));
BufferStrategy bs;
if ((bs = f.getBufferStrategy()) == null) {
f.createBufferStrategy(2);
bs = f.getBufferStrategy();
}
Rectangle bounds = f.getBounds();
Dimension screenDims = new Dimension(bounds.width,bounds.height);
// GameModel model = new GameModel(screenDims,new InputListener(f));
ScreenManager manager = new ScreenManager(screenDims,new InputListener(f));
manager.addScreen(new MainMenuScreen(manager));
final MainThread main = new MainThread(bs,manager);
f.addWindowListener(new WindowListener() {
public void windowActivated(WindowEvent arg0) {
}
public void windowClosed(WindowEvent arg0) {
}
public void windowClosing(WindowEvent arg0) {
main.setRunning(false);
System.exit(0);
}
public void windowDeactivated(WindowEvent arg0) {
}
public void windowDeiconified(WindowEvent arg0) {
}
public void windowIconified(WindowEvent arg0) {
}
public void windowOpened(WindowEvent arg0) {
}
});
main.setRunning(true);
main.start();
} catch (Exception e) {
e.printStackTrace();
gd.setFullScreenWindow(null);
} finally {
}
}
|
a2b33478-e63e-4d8f-bb96-7743ff9985ec
| 0
|
public ActiveActivities getActiveActivity() {
return activeActivity;
}
|
628b9aef-b48d-4e70-8fb1-364a9e5b4c6d
| 0
|
public void setAgeCategory(AgeCategories ageCategory) {
this.ageCategory = ageCategory;
}
|
dbbf81c8-0ee4-410d-88f2-102dfbd830b8
| 9
|
private File createFile(final String fileName) {
final File locFile = addCommand.getFileEndingWith(fileName);
if (locFile == null) {
// in case the exact match was not achieved using the
// getFileEndingWith method
// let's try to find the best match possible.
// iterate from the back of the filename string and try to match the
// endings
// of getFiles(). the best match is picked then.
// Works ok for files and directories in add, should not probably be
// used
// elsewhere where it's possible to have recursive commands and
// where resulting files
// are not listed in getFiles()
final String name = fileName.replace('\\', '/');
final File[] files = addCommand.getFiles();
name.length();
File bestMatch = null;
final String[] paths = new String[files.length];
for (int index = 0; index < files.length; index++) {
paths[index] = files[index].getAbsolutePath().replace('\\', '/');
}
int start = name.lastIndexOf('/');
String part = null;
if (start < 0) {
part = name;
} else {
part = name.substring(start + 1);
}
while ((start >= 0) || (part != null)) {
boolean wasMatch = false;
for (int index = 0; index < paths.length; index++) {
if (paths[index].endsWith(part)) {
bestMatch = files[index];
wasMatch = true;
}
}
start = name.lastIndexOf('/', start - 1);
if ((start < 0) || !wasMatch) {
break;
}
part = name.substring(start + 1);
}
return bestMatch;
}
return locFile;
}
|
9e5b94d3-2c22-4dcb-8e72-aa75cba68eeb
| 9
|
private static void indexDocs(String url) throws Exception {
try {
// Crawl links
LinkParser lp = new LinkParser(url);
URL[] links = lp.ExtractLinks();
if (links.length == 0 || shouldnotVisit(url)) {
return;
}
indexed.add(url);
for (URL l : links) {
if ((!indexed.contains(l.toURI().toString())) && l != null
&& (!l.toURI().toString().contains("?"))
&& (!l.toURI().toString().contains("#")) && i < 100) {
i = i + 1;
indexDocs(l.toURI().toString());
}
}
} catch (Exception e) {
System.out.println(e.toString());
}
}
|
9ba985f7-e311-4208-a294-1b76a4c64401
| 1
|
public void onScannedRobot(ScannedRobotEvent e){
if (e.getName() == Observer.TARGET){
robot.setTurnRight(e.getBearing());
}
}
|
425e0f39-0394-41d1-83cb-16c8bdf7c9f3
| 3
|
public String prox() {
int sorteio = g.nextInt(100);
int iCaso;
for (iCaso = 0; iCaso < distribuicao.length; iCaso++)
if (sorteio < distribuicao[iCaso])
break;
ExpressaoGeradora caso = cartucho[iCaso];
String mtg = "";
ParteDeExpressao[] partes = caso.toArray();
for (int i = 0; i < partes.length; i++) {
mtg = mtg + partes[i].gerar();
}
return mtg;
}
|
58e327a0-32b7-4808-a02b-446e60a4203f
| 8
|
public void paint(Graphics g) {
g.setColor(FONDO);
g.fillRect(0, 0, ancho, alto);
if(Ventana.getTab()!=null)
{
for (int i = 0; i < Tablero.filas; i++) {
for (int j = 0; j < Tablero.columnas; j++) {
switch (Tablero.tab[i][j]) {
case 0:
g.setColor(FONDO);
break;
case 1:
g.setColor(Color.red);
break;
case 2:
g.setColor(Color.green);
break;
case 3:
g.setColor(Color.blue);
break;
case 9: g.setColor(Color.black);
break;
}
g.fillRect(j * wP, i * hP, wP, hP);
}
}
}
Teclado.activar();
}
|
d6706c5c-911f-42c2-b6a1-df7c7fa8358c
| 4
|
public void addTableListener(JTable table) {
table.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
JTable source = (JTable) e.getSource();
int row = source.rowAtPoint(e.getPoint());
/*
* show menu only on right click and if the click was made
* inside the table area
*/
if (e.isPopupTrigger()
&& (row >= 0 && row < source.getRowCount())) {
int column = source.columnAtPoint(e.getPoint());
// initialize context menu
JPopupMenu contextMenu = new JPopupMenu();
if (createPopUpMenu(contextMenu, source, row, column))
contextMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
});
}
|
29d1bdd5-297a-4a0b-bab9-1228e2c03c81
| 2
|
public ExerciseChooser(List<Exercise> new_exercises) throws BadInput {
if (new_exercises.size() < 1)
throw new BadInput("Must have at least one exercise to choose from!");
exercises = new_exercises;
exercises.add(0, new QuitExercise());
for (Exercise ex : exercises) {
titles.add(ex.getTitle());
}
}
|
f754e4c3-9e44-4bb1-8a71-fc500baa25fc
| 6
|
public void sql_lookup() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Statement s = GUI.con.createStatement();
//CHANGE FUNCTION BASED ON HIERARCHY
if(GUI.Level == 1)
{
s.executeQuery ("SELECT * FROM all_users");
}
else if(GUI.Level == 2)
{
s.executeQuery ("SELECT * FROM all_users WHERE G_Name = \'"+GUI.ugn+"\';");
}
ResultSet rs = s.getResultSet();
boolean found = false;
int id = 0, hier = 0;
String input_last_name = lname_input.getText();
String input_first_name = fname_input.getText();
String f_name = "", l_name = "", u_name = "", p_word = "", a_code = "", g_name = "";
while (rs.next() && found == false)
{
//SETTING LOCAL VALUES EQUAL TO VALUES FROM DATABASE
id = rs.getInt("ID");
hier = rs.getInt("Hierarchy");
u_name = rs.getString ("User_Name");
f_name = rs.getString("First_Name");
l_name = rs.getString("Last_Name");
p_word = rs.getString("Pass_Word");
a_code = rs.getString("Access_Code");
g_name = rs.getString("G_Name");
//FIND ACCOUNT IN DATABASE ACCORDING TO FIRST AND LAST NAME ENTERED IN GUI
if((l_name.equals(input_last_name))&&(f_name.equals(input_first_name)))
{
found = true;
Combo_Box_View_Specific_Account.outputer.setText(id + " " + hier + " " + f_name + " " + l_name + " " + u_name + " " + p_word + " " + a_code + " " + g_name);
}
}
rs.close();
s.close();
//GUI.con.close();
//-------------------------------------||
}
|
6a4f4527-884c-4306-a66a-61d112971d07
| 1
|
public void exchange(int[] A,int i,int j){
if(i != j){
int var = A[i];
A[i] = A[j];
A[j] = var;
}
}
|
cfc6e4f1-9f33-4208-bae9-491e368388c6
| 9
|
public static void main(String[] args) {
if (args.length != 2) {
System.out.println(USAGE);
System.exit(0);
}
InetAddress addr = null;
int port = 0;
Socket sock = null;
// check args[1] - the IP-adress
try {
addr = InetAddress.getByName(args[0]);
} catch (UnknownHostException e) {
System.out.println(USAGE);
System.out.println("ERROR: host " + args[0] + " unknown");
System.exit(0);
}
// parse args[2] - the port
try {
port = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
System.out.println(USAGE);
System.out.println("ERROR: port " + args[1] + " is not an integer");
System.exit(0);
}
// try to open a Socket to the server
try {
sock = new Socket(addr, port);
} catch (IOException e) {
System.out.println("ERROR: could not create a socket on " + addr + " and port " + port);
}
try {
BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
Scanner userIn = new Scanner(System.in);
String input;
while (true) {
// Requesting the following recipe will spit out the server code.
// ../src/ss/week7/recipeserver/RecipeServer.java
// The issue is that paths aren't validated properly and a rogue client can use the
// .. path to move up a directory, which then gives access to the root directory of
// the repo, which in turn gives access to the server's source file.
input = userIn.nextLine();
if (input.equals("exit")) {
break;
} else {
out.write("GET " + input);
out.newLine();
out.flush();
System.out.println("Recipe text:");
System.out.println("------");
String line = in.readLine();
while (line != null && !line.equals("--EOT--")) {
// The server uses a special string ("--EOT--") to mark the end of a recipe.
System.out.println(line);
line = in.readLine();
}
System.out.println("------");
}
}
System.out.println("Exiting.");
userIn.close();
} catch (IOException e) {
System.out.println("ERROR: unable to communicate to server");
e.printStackTrace();
}
}
|
31e6d546-6d0f-4a3b-85b4-3e89adc33b0d
| 0
|
@Test
public void testManualStart()
throws Exception
{
Thread.sleep( 5000L );
assertTrue( timedTask.getInvocationsTimedTaskA() == 0 );
scheduler.start();
Thread.sleep( 5000L );
assertTrue( timedTask.getInvocationsTimedTaskA() > 0 );
}
|
23b49c4a-fcd2-4276-ac48-b5211fe0942f
| 0
|
public static boolean isTerminal(char ch) {
return !isVariable(ch);
}
|
c98d45ba-2ca7-404f-8f4b-beb77adcc3ac
| 0
|
public String getDescription() {
return description;
}
|
4c3d4043-f09f-4fea-a139-365a91e5934d
| 7
|
public static void main(String[] args) throws Exception {
if( args.length != 4)
throw new Exception("Example d'appel : recepteur <numero_de_port_en_ecoute> <taille_de_fenetre> <fichier> <pourcentage_perte_segment>");
int port = Integer.parseInt(args[0]);
if (port <= 1024)
throw new Exception("Erreur : le port d'écoute doit être supérieur à 1024 pour éviter les problèmes de droit.");
long WIN = Long.parseLong(args[1]);
if (WIN <= 0 || WIN > 8)
throw new Exception("Erreur : la taille de la fenêtre ne peut être nulle ou dépasser la valeur de 8.");
int lostSequence = 100-Integer.parseInt(args[3]);
if (lostSequence <= 0 || lostSequence > 100)
throw new Exception("Erreur : le pourcentage de perte ne peut être inférieur à 0% et ne doit pas être supérieur à 99%.");
String filename = args[2];
if (!new File(System.getProperty("user.dir") + File.separator +filename).exists())
throw new Exception("Erreur : le fichier demandé est introuvable.");
UDPServer server = new UDPServer(port,WIN,filename,lostSequence);
}
|
ead8b5fe-f71b-4728-bd67-7bab20652510
| 3
|
public String listDir() throws IOException{
String[] listGames = charDir.list();
String fileName = "";
if (listGames == null || listGames.length == 0) {
fileName = "There are no saved games";
}
else{
fileName = "*******Saved Games*******\n";
for (int i = 0; i < listGames.length; i++) {
fileName = fileName + listGames[i] + "\n";
}
confirmSav = true;
}
return fileName;
}
|
74cf22b7-50e5-4690-9f27-83fc552649d5
| 9
|
static final void method610(int i, int i_0_, int i_1_, int i_2_, byte b, int i_3_, int i_4_) {
Class262_Sub11.method3175(i_2_, 111);
anInt906++;
int i_5_ = 0;
int i_6_ = i_2_ + -i_4_;
if (i_6_ < 0) {
i_6_ = 0;
}
int i_7_ = i_2_;
int i_8_ = -i_2_;
int i_9_ = i_6_;
if (b != -56) {
method609((byte) -87);
}
int i_10_ = -i_6_;
int i_11_ = -1;
int i_12_ = -1;
int[] is = Class169_Sub4.anIntArrayArray8826[i_1_];
int i_13_ = -i_6_ + i_3_;
Class369.method4086(i_13_, i, -i_2_ + i_3_, is, 0);
int i_14_ = i_3_ + i_6_;
Class369.method4086(i_14_, i_0_, i_13_, is, b + 56);
Class369.method4086(i_3_ - -i_2_, i, i_14_, is, 0);
while (i_5_ < i_7_) {
i_11_ += 2;
i_12_ += 2;
i_10_ += i_12_;
i_8_ += i_11_;
if ((i_10_ ^ 0xffffffff) <= -1 && (i_9_ ^ 0xffffffff) <= -2) {
Class188_Sub1_Sub2.anIntArray9345[i_9_] = i_5_;
i_9_--;
i_10_ -= i_9_ << 1;
}
i_5_++;
if ((i_8_ ^ 0xffffffff) <= -1) {
if (--i_7_ < i_6_) {
int[] is_15_ = Class169_Sub4.anIntArrayArray8826[i_7_ + i_1_];
int[] is_16_ = Class169_Sub4.anIntArrayArray8826[-i_7_ + i_1_];
int i_17_ = Class188_Sub1_Sub2.anIntArray9345[i_7_];
int i_18_ = i_5_ + i_3_;
int i_19_ = -i_5_ + i_3_;
int i_20_ = i_17_ + i_3_;
int i_21_ = -i_17_ + i_3_;
Class369.method4086(i_21_, i, i_19_, is_15_, 0);
Class369.method4086(i_20_, i_0_, i_21_, is_15_, b ^ ~0x37);
Class369.method4086(i_18_, i, i_20_, is_15_, 0);
Class369.method4086(i_21_, i, i_19_, is_16_, 0);
Class369.method4086(i_20_, i_0_, i_21_, is_16_, 0);
Class369.method4086(i_18_, i, i_20_, is_16_, 0);
} else {
int[] is_22_ = Class169_Sub4.anIntArrayArray8826[i_1_ + i_7_];
int[] is_23_ = Class169_Sub4.anIntArrayArray8826[i_1_ - i_7_];
int i_24_ = i_3_ - -i_5_;
int i_25_ = -i_5_ + i_3_;
Class369.method4086(i_24_, i, i_25_, is_22_, 0);
Class369.method4086(i_24_, i, i_25_, is_23_, 0);
}
i_8_ -= i_7_ << 1;
}
int[] is_26_ = Class169_Sub4.anIntArrayArray8826[i_1_ - -i_5_];
int[] is_27_ = Class169_Sub4.anIntArrayArray8826[i_1_ - i_5_];
int i_28_ = i_7_ + i_3_;
int i_29_ = -i_7_ + i_3_;
if (i_6_ > i_5_) {
int i_30_ = (i_9_ ^ 0xffffffff) > (i_5_ ^ 0xffffffff) ? Class188_Sub1_Sub2.anIntArray9345[i_5_] : i_9_;
int i_31_ = i_3_ + i_30_;
int i_32_ = -i_30_ + i_3_;
Class369.method4086(i_32_, i, i_29_, is_26_, 0);
Class369.method4086(i_31_, i_0_, i_32_, is_26_, 0);
Class369.method4086(i_28_, i, i_31_, is_26_, b ^ ~0x37);
Class369.method4086(i_32_, i, i_29_, is_27_, 0);
Class369.method4086(i_31_, i_0_, i_32_, is_27_, 0);
Class369.method4086(i_28_, i, i_31_, is_27_, 0);
} else {
Class369.method4086(i_28_, i, i_29_, is_26_, b + 56);
Class369.method4086(i_28_, i, i_29_, is_27_, b ^ ~0x37);
}
}
}
|
8114bcc3-151f-4111-b6d0-16d20600fd64
| 0
|
public void setMember(Member member) {
this.member = member;
}
|
ecadba66-d7ee-4bb0-81d4-29abceaef6e5
| 5
|
@Override
public void deserialize(Buffer buf) {
id = buf.readUShort();
if (id < 0 || id > 65535)
throw new RuntimeException("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0 || id > 65535");
status = buf.readByte();
if (status < 0)
throw new RuntimeException("Forbidden value on status = " + status + ", it doesn't respect the following condition : status < 0");
completion = buf.readByte();
if (completion < 0)
throw new RuntimeException("Forbidden value on completion = " + completion + ", it doesn't respect the following condition : completion < 0");
isSelectable = buf.readBoolean();
charactersCount = buf.readByte();
if (charactersCount < 0)
throw new RuntimeException("Forbidden value on charactersCount = " + charactersCount + ", it doesn't respect the following condition : charactersCount < 0");
date = buf.readDouble();
}
|
48b30d49-e900-4a1d-babb-49ee7ddd332a
| 2
|
public int size() {
return e1 == null ? 0 : (e2 == null ? 1 : 2);
}
|
82bf212f-401a-4ab3-a442-8c10a30cec4b
| 7
|
private static void argsCommand(String[] args)
{
for(int i = 0; i < args.length; i++)
{
switch(args[i].toLowerCase())
{
case "-ip":
if(args[i + 1].trim().split(":").length == 2)
{
networkIP = args[i + 1].split(":", 2)[0].trim();
rmiPort = Integer.parseInt(args[i + 1].split(":", 2)[1].trim());
i++;
}
else
{
System.out.println("Invalid arguments for -ip");
}
break;
case "-tcp":
tcpPort = Integer.parseInt(args[i+1].trim());
i++;
break;
case "-multicast":
if(args[i + 1].trim().split(":").length == 2)
{
multicastIP = args[i + 1].trim().split(":", 2)[0];
multicastPort = Integer.parseInt(args[i + 1].trim().split(":", 2)[1]);
i++;
}
else
{
System.out.println("Invalid arguments for -multicast");
}
break;
case "-help":
System.out.println("SystemY Server application - 2014");
System.out.println("Starts the server for connecting to SystemY. SystemY is a distributed file system for local networks.");
System.out.println("\nOptions: ");
System.out.println("\t-ip {ip}:{port}\t\tThe given ip will be used for all communication from the server to the network.\n\t\t\t\tThe ip must be the ip of the physical interface connected to the local network with SystemY.");
System.out.println("\t-tcpPort {port}\tThis feature is for future purposes.");
System.out.println("\t-multicast {ip}:{port}\tThis feature is for future purposes.");
System.exit(0);
default:
System.out.println("Unkown option '" + args[i] + "'");
break;
}
}
}
|
33f087fa-1d92-486b-b2c7-2c1b7cc5556f
| 3
|
private static String inputStreamToString(final InputStream inputStream) throws Exception {
final StringBuilder outputBuilder = new StringBuilder();
try {
String string;
if (inputStream != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, ENCODING));
while (null != (string = reader.readLine())) {
outputBuilder.append(string).append('\n');
}
}
} catch (Exception ex) {
throw new Exception("[google-api-translate-java] Error reading translation stream.", ex);
}
return outputBuilder.toString();
}
|
f5bf55da-5dc2-41cd-b23c-82a57e264d61
| 9
|
public static Stella_Object argumentBoundTo(Stella_Object self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
{ PatternVariable self000 = ((PatternVariable)(self));
{ Stella_Object value = (((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord.variableBindings.theArray)[(self000.boundToOffset)];
if ((value == null) &&
(((Stella_Object)(Stella_Object.accessInContext(self000.variableValue, self000.homeContext, false))) != null)) {
value = Logic.valueOf(self000);
if (Logic.skolemP(value)) {
return (null);
}
PatternVariable.bindVariableToValueP(self000, value, true);
}
return (value);
}
}
}
else if (Surrogate.subtypeOfSurrogateP(testValue000)) {
{ Surrogate self000 = ((Surrogate)(self));
return (Logic.valueOf(self000));
}
}
else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_DESCRIPTION)) {
{ Description self000 = ((Description)(self));
if ((((Vector)(KeyValueList.dynamicSlotValue(self000.dynamicSlots, Logic.SYM_LOGIC_EXTERNAL_VARIABLES, null))) != null) &&
Proposition.containsOperatorP(self000.proposition, Logic.SGT_PL_KERNEL_KB_HOLDS)) {
{ Description temp000 = Description.findDuplicateDescription(self000);
{ Description value000 = ((temp000 != null) ? temp000 : self000);
return (value000);
}
}
}
return (Logic.valueOf(self000));
}
}
else {
return (Logic.valueOf(self));
}
}
}
|
33216dde-0228-4cce-ade7-99610c9d129b
| 3
|
public void addHeaderRecord(String line) {
if( !line.startsWith("@") ) throw new RuntimeException("Record type must start with '@'. Header line: " + line);
// Add line
lines.add(line);
// Parse records
SamHeaderRecord shr = null;
if( line.startsWith("@SQ") ) shr = new SamHeaderRecordSq(line);
if( shr != null ) add(shr);
}
|
b23760d1-3d16-4929-b72e-9e6a76a96d9a
| 2
|
public String GrabLatest()
{
String Return = null;
int i = 0;
for(String Line : Log.toString().split(System.getProperty("line.separator")))
{
if (i > Log.toString().split(System.getProperty("line.separator")).length)
{
i++;
continue;
}
Return = Line;
}
return Return;
}
|
3b10487e-facd-4a8f-8a87-21a115e24cab
| 8
|
public void changeTerrain(Terrain terrain) {
Terrain oldTerrain = this.terrain;
for (int i = 0; i < 2; i++) {
for (Card card : this.duelists[i].deck.cards) {
this.applyTerrain(oldTerrain, card, true);
}
for (Card card : this.duelists[i].hand.cards) {
this.applyTerrain(oldTerrain, card, true);
}
for (MonsterZone mz : this.duelists[i].field.monsterzones) {
this.applyTerrain(oldTerrain, mz.card, true);
}
}
this.terrain = terrain;
for (int i = 0; i < 2; i++) {
for (Card card : this.duelists[i].deck.cards) {
this.applyTerrain(terrain, card, false);
}
for (Card card : this.duelists[i].hand.cards) {
this.applyTerrain(terrain, card, false);
}
for (MonsterZone mz : this.duelists[i].field.monsterzones) {
this.applyTerrain(terrain, mz.card, false);
}
}
}
|
a2527855-92c7-42de-8de2-7f15f4578e9d
| 6
|
public static void method460(byte abyte0[], int j)
{
if(abyte0 == null)
{
Class21 class21 = aClass21Array1661[j] = new Class21();
class21.anInt369 = 0;
class21.anInt370 = 0;
class21.anInt371 = 0;
return;
}
Stream stream = new Stream(abyte0);
stream.currentOffset = abyte0.length - 18;
Class21 class21_1 = aClass21Array1661[j] = new Class21();
class21_1.aByteArray368 = abyte0;
class21_1.anInt369 = stream.readUnsignedWord();
class21_1.anInt370 = stream.readUnsignedWord();
class21_1.anInt371 = stream.readUnsignedByte();
int k = stream.readUnsignedByte();
int l = stream.readUnsignedByte();
int i1 = stream.readUnsignedByte();
int j1 = stream.readUnsignedByte();
int k1 = stream.readUnsignedByte();
int l1 = stream.readUnsignedWord();
int i2 = stream.readUnsignedWord();
int j2 = stream.readUnsignedWord();
int k2 = stream.readUnsignedWord();
int l2 = 0;
class21_1.anInt372 = l2;
l2 += class21_1.anInt369;
class21_1.anInt378 = l2;
l2 += class21_1.anInt370;
class21_1.anInt381 = l2;
if(l == 255)
l2 += class21_1.anInt370;
else
class21_1.anInt381 = -l - 1;
class21_1.anInt383 = l2;
if(j1 == 1)
l2 += class21_1.anInt370;
else
class21_1.anInt383 = -1;
class21_1.anInt380 = l2;
if(k == 1)
l2 += class21_1.anInt370;
else
class21_1.anInt380 = -1;
class21_1.anInt376 = l2;
if(k1 == 1)
l2 += class21_1.anInt369;
else
class21_1.anInt376 = -1;
class21_1.anInt382 = l2;
if(i1 == 1)
l2 += class21_1.anInt370;
else
class21_1.anInt382 = -1;
class21_1.anInt377 = l2;
l2 += k2;
class21_1.anInt379 = l2;
l2 += class21_1.anInt370 * 2;
class21_1.anInt384 = l2;
l2 += class21_1.anInt371 * 6;
class21_1.anInt373 = l2;
l2 += l1;
class21_1.anInt374 = l2;
l2 += i2;
class21_1.anInt375 = l2;
l2 += j2;
}
|
8b9e36fb-3e1e-4cce-a9b9-f9a892191ae0
| 6
|
public static Integer getMaxJLPT() {
if (JLPT0) return 0;
if (JLPT1) return 1;
if (JLPT2) return 2;
if (JLPT3) return 3;
if (JLPT4) return 4;
if (JLPT5) return 5;
else
return 0;
}
|
ebb9fc67-d6e1-499d-9a8b-ce3b8595a2b4
| 1
|
public int getBaud() throws ChannelException {
try {
return port.getBaudRate();
}
catch (NullPointerException ex) {
throw new ChannelException(ex);
}
}
|
9a73cee5-ef71-47a3-988f-a74aa271de7a
| 5
|
public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String campos = colum_names[0];
for (int i = 1; i < colum_names.length; i++) {
campos+=",";
campos+=colum_names[i];
}
String consulta = ("SELECT "+campos+" "+
"FROM "+name_tabla+" WITH (INDEX("+indices_tabla[numero_ordenamiento_elegido]+"))");
PreparedStatement pstm = r_con.getConn().prepareStatement(consulta);
ResultSet res = pstm.executeQuery();
int i = 0;
while(res.next()){
for (int j = 0; j < colum_names.length; j++) {
data[i][j] = res.getString(j+1);
}
i++;
}
res.close();
}
} catch(SQLException e){
System.out.println(e);
} finally {
r_con.cierraConexion();
}
return data;
}
|
eccaaa0c-291b-405c-996c-deb784b2ecdb
| 7
|
public aos.jack.jak.logic.ChoicePoint getChoicePoint()
{
if (id != null)
return id.getEnv().newChoicePoint();
if (warningCount != null)
return warningCount.getEnv().newChoicePoint();
if (upload != null)
return upload.getEnv().newChoicePoint();
if (download != null)
return download.getEnv().newChoicePoint();
if (isOnline != null)
return isOnline.getEnv().newChoicePoint();
if (cumulativeOnlineTime != null)
return cumulativeOnlineTime.getEnv().newChoicePoint();
if (delay != null)
return delay.getEnv().newChoicePoint();
return null;
}
|
156fa845-801b-417f-b0de-8666df581b1c
| 0
|
public TiedostonlukijaTest() {
}
|
dc67105f-1feb-4a64-a791-2a05ddefcb41
| 2
|
@Override
public void keyPressed(KeyEvent e) {
if(e.getSource().equals(iptf)) {
if(e.getKeyCode() == KeyEvent.VK_ENTER) {
connectToServer();
}
}
}
|
87cc5757-cc97-4aa4-a995-458fdce85ed0
| 9
|
final public Unit Ctor(ClassUnit classUnit) throws ParseException {
MethodUnit methodUnit = new MethodUnit();
Modifier modifier = null;
List<Unit> formalArgs = null;
Token t = null;
String functionName = null;
SimpleNode type = null;
block_AST block = null;
modifier = Modifier();
functionName = ID();
id_AST jjtn001 = new id_AST(JJTID_AST);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
jjtree.closeNodeScope(jjtn001, true);
jjtc001 = false;
type = jjtn001;
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, true);
}
}
jj_consume_token(LP);
if (MODE == 0) {
methodUnit = (MethodUnit)SYMBOL_TABLE.add(functionName,UnitType.METHOD);
methodUnit.setName(functionName);
methodUnit.setConstructor(true);
} else {
IntegerMuted intMuted = new IntegerMuted(-1);
methodUnit = (MethodUnit)SYMBOL_TABLE.lookUp(functionName,UnitType.METHOD, intMuted);
}
type.typeObj.name = functionName;
type.typeObj.isClass = true;
methodUnit.setReturnType(type);
methodUnit.classUnit = classUnit;
methodUnit.setModifier(modifier);
SYMBOL_TABLE.enterScopeForUnit(methodUnit,MODE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEAN:
case CHAR:
case INT:
case ID:
formalArgs = FormalArgs();
if (MODE == 0) {
methodUnit.setFormalArgs(formalArgs);
}
break;
default:
jj_la1[15] = jj_gen;
;
}
jj_consume_token(RP);
block = Block();
SYMBOL_TABLE.exitScope(MODE);
methodUnit.setMethodBlock((block_AST)block);
{if (true) return methodUnit;}
throw new Error("Missing return statement in function");
}
|
fdf380a1-45de-492f-a2d3-7b5b59d8994a
| 1
|
public static void main(String[] args){
MasterMindAI ai = new MasterMindAI(3);
String code = "1357";
List<String> guessHistory = new ArrayList<String>();
List<String> feedbackHistory = new ArrayList<String>();
for (int i = 0; i < 10; i ++){
String guess = ai.generateGuess();
guessHistory.add(guess);
feedbackHistory.add(CodeFeedback.getValidFeedback(code, guess));
ai.filter(guessHistory, feedbackHistory);
}
System.out.println("===");
System.out.println(guessHistory);
System.out.println(feedbackHistory);
System.out.println(ai.generateGuess());
}
|
d2d4e265-3cdd-4802-a342-c376e9f4d6ad
| 3
|
public static Matrix readFromFile(String path, DataType dataType) throws MatrixIndexOutOfBoundsException {
Matrix matrix = null;
int rows;
int cols;
try {
Scanner in = new Scanner(new FileReader(path));
rows = in.nextInt();
cols = in.nextInt();
//creates the matrix
matrix = MatrixSelector.getMatrix(rows, cols, dataType);
in.useLocale(Locale.US);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrix.setValue(i, j, in.nextDouble());
}
}
} catch (FileNotFoundException ex) {
System.out.println("The specified file is not found!");
}
return matrix;
}
|
792e83a5-68c3-4f17-8fdf-acc28164b993
| 9
|
public void step() {
if (animation == Animation.WALKING || animation == Animation.FALLING) {
cycleCounter++;
if (cycleCounter > 5) {
cycleIndex = (cycleIndex + 1) % textures[animation.ordinal()].length;
texture = textures[animation.ordinal()][cycleIndex];
cycleCounter = 0;
}
} else if (animation == Animation.LANDING) {
cycleCounter++;
if (cycleCounter > 3) {
cycleIndex++;
if (cycleIndex < textures[animation.ordinal()].length) {
texture = textures[animation.ordinal()][cycleIndex];
} else {
setAnimation(Animation.WALKING);
}
cycleCounter = 0;
}
} else if (animation == Animation.JUMPING) {
cycleCounter++;
if (cycleCounter > 6) {
cycleIndex++;
if (cycleIndex < textures[animation.ordinal()].length) {
texture = textures[animation.ordinal()][cycleIndex];
}
}
}
}
|
02397644-fea9-4960-884f-ead084970c60
| 9
|
public static <T, K extends Goliath.DynamicEnum> T createObject(Class<T> toClass, java.lang.Object[] taParams)
throws Goliath.Exceptions.InvalidParameterException
{
// A Dynamic enum is a core part of the framework. Each enumeration class within a dynamic enum is a singleton, so is dealt with accordingly
if (Java.isEqualOrAssignable(Goliath.DynamicEnum.class, toClass))
{
List<K> loDEClasses = Goliath.DynamicEnum.getEnumerations((Class<K>) toClass);
for (Object loDEClass : loDEClasses)
{
if (loDEClass.getClass() == toClass)
{
return (T)loDEClass;
}
}
throw new ObjectNotCreatedException("Unable to create object "+toClass.getCanonicalName());
}
else
{
int lnLength = (taParams != null) ? taParams.length : 0;
Class[] laClasses = new Class[lnLength];
for (int i=0; i<lnLength; i++)
{
laClasses[i] = taParams[i].getClass();
}
// Get the constructor
try
{
Constructor loConstructor = getConstructor(toClass, laClasses);
if (loConstructor != null)
{
boolean llIsAccessible = loConstructor.isAccessible();
if (!llIsAccessible)
{
loConstructor.setAccessible(true);
}
java.lang.Object loReturn = loConstructor.newInstance(taParams);
if (!llIsAccessible)
{
loConstructor.setAccessible(false);
}
return (T)loReturn;
}
else
{
throw new Goliath.Exceptions.ObjectNotCreatedException("No constructor found on " + toClass.getSimpleName() + " with argument types " + laClasses.toString());
}
}
catch(Throwable ex)
{
throw new Goliath.Exceptions.ObjectNotCreatedException(ex);
}
}
}
|
0315d43f-f233-412b-9d82-7ea505887221
| 5
|
public FileConfiguration load() {
// Flush any pending save requests first to avoid losing any previous edits not yet committed
if (this.isSaveQueued()) this.save();
// Use existing file
this.config = YamlConfiguration.loadConfiguration(this.file);
if (this.file.exists()) {
if (this.getVersion().compareTo(this.minVersion) >= 0) return this.config;
// Backup existing file
String backupName = this.file.getName().substring(0, this.file.getName().lastIndexOf("."));
backupName += " - Backup version " + this.getVersion().toString() + " - " + new SimpleDateFormat("yyyyMMdd'T'HHmm").format(new Date()) + ".yml";
final File backup = new File(this.file.getParentFile(), backupName);
this.owner.getLogger().log(Level.WARNING, "Existing configuration file \"" + this.file.getPath() + "\" with version \"" + this.getVersion() + "\" is out of date; Required minimum version is \"" + this.minVersion + "\"; Backing up existing file to \"" + backup.getPath() + "\"");
this.file.renameTo(backup);
// Clear out-dated configuration
this.config = new YamlConfiguration();
}
// Load defaults supplied in JAR
final InputStream defaults = (this.defaults != null ? this.owner.getClass().getResourceAsStream(this.defaults) : null);
if (defaults != null) {
this.config.setDefaults(YamlConfiguration.loadConfiguration(defaults));
this.config.options().copyDefaults(true);
this.save();
this.config = YamlConfiguration.loadConfiguration(this.file);
return this.config;
}
// No file, no defaults, reset to empty configuration
this.clear();
return this.config;
}
|
a5126c25-725f-401b-a331-091f4ae6a756
| 7
|
@Before
public void setUp(){
Assert.assertNotNull(input);
LinkedList<String> records = new LinkedList<String>();
try {
FileReader reader = new FileReader(input);
int read = reader.read();
while(read > -1){
StringBuilder sb = new StringBuilder();
while('\r' != (char)read && '\n' != (char)read && read > -1){
sb.append((char)read);
read = reader.read();
}
records.add(sb.toString());
read = reader.read();
}
reader.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
log.info(String.valueOf(records.size()));
for(String s : records) parse(s);
}
|
f0517df2-9384-4c69-927d-005a33ff2947
| 5
|
private int getX(Dimensions dim){
Face direction = surface.roomView.playerDirection;
if (direction == Face.EASTERN){
if (ceiling){
return 100 - dim.getY();
}
return dim.getY();
}
if (direction == Face.SOUTHERN){
return 100 - dim.getX();
}
if (direction == Face.WESTERN){
if (ceiling){
return dim.getY();
}
return 100 - dim.getY();
}
//must be facing north
return dim.getX();
}
|
0330719f-b8bd-4100-b75a-79a0d14071eb
| 6
|
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var11;
for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4)
{
;
}
for (int var7 = 0; var7 < 4; ++var7)
{
int var8 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8);
int var9 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4);
int var10 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8);
if (par1World.isAirBlock(var8, var9, var10) && ((BlockFlower)Block.blocksList[this.deadBushID]).canBlockStay(par1World, var8, var9, var10))
{
par1World.setBlock(var8, var9, var10, this.deadBushID);
}
}
return true;
}
|
2b8b1be0-04bb-4396-ba99-1e1e1ba24531
| 4
|
public float getMinValue() {
if(!changeMin)
return lastMin;
changeMin = false;
float minValue;
minValue = matrix[0][0];
for(int i = 0; i < row; ++i)
for(int j = 0; j < column; ++j) {
if(matrix[i][j] < minValue)
minValue = matrix[i][j];
}
lastMin = minValue;
return minValue;
}
|
71c7b279-7d7b-44f8-a0f3-82377c8b5060
| 6
|
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLink != null) && (Updater.this.type != UpdateType.NO_DOWNLOAD)) {
String name = Updater.this.file.getName();
// If it's a zip file, it shouldn't be downloaded as the plugin's name
if (Updater.this.versionLink.endsWith(".zip")) {
final String[] split = Updater.this.versionLink.split("/");
name = split[split.length - 1];
}
Updater.this.saveFile(new File(Updater.this.plugin.getDataFolder().getParent(), Updater.this.updateFolder), name, Updater.this.versionLink);
} else {
Updater.this.result = UpdateResult.UPDATE_AVAILABLE;
}
}
}
}
}
|
2673c487-265a-4d47-b24a-7e6767e8d714
| 3
|
/* */ public PlayerState(CraftPlayer p)
/* */ {
/* 34 */ this.player = p;
/* 35 */ this.inventory = p.getInventory().getContents();
/* 36 */ this.armor = p.getInventory().getArmorContents();
/* 37 */ this.hunger = p.getFoodLevel();
/* 38 */ this.health = p.getHealth();
/* 39 */ this.level = p.getLevel();
/* 40 */ this.exp = p.getExp();
/* 41 */ this.slot = p.getInventory().getHeldItemSlot();
/* 42 */ this.allowFlight = p.getAllowFlight();
/* 43 */ this.isFlying = p.isFlying();
/* 44 */ this.mode = p.getGameMode();
/* 45 */ this.location = p.getLocation();
/* */
/* 47 */ this.potions = p.getActivePotionEffects();
/* */
/* 49 */ for (Player players : Bukkit.getServer().getOnlinePlayers())
/* */ {
/* 51 */ if (players != p)
/* */ {
/* 53 */ if (!players.canSee(p))
/* */ {
/* 55 */ this.vanishedFrom.add(players);
/* */ }
/* */ }
/* */ }
/* */ }
|
e3557c39-538e-44a6-add5-1af3c0acc056
| 3
|
public void drawWaveText(int color, String text, int x, int effectSpeed, int y) { // method386
if (text == null) {
return;
}
x -= getANTextWidth(text) / 2;
y -= trimHeight;
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (c != ' ') {
drawChar(pixels[c], x + horizontalKerning[c], y + verticalKerning[c] + (int) (Math.sin(i / 2D + effectSpeed / 5D) * 5D), width[c], height[c], color);
}
x += charWidths[c];
}
}
|
b866e51b-e18e-4d2f-8ad6-c3f52de4af41
| 3
|
@Override
public ParseResult<T, List<T>> parse(LList<T> tokens) {
LList<T> restTokens = tokens;
for(T t : this.string) {
// I believe it's safe to use Optional.get() here b/c
// if the size is greater than 1, that means the Optional
// *is* present
if(restTokens.size() > 0 && this.comp.compare(t, restTokens.getHead().get()) == 0) {
// cool, keep going
restTokens = restTokens.getTail().get();
} else {
return ParseResult.failure("can't match string", tokens);
}
}
return ParseResult.success(restTokens, this.string);
}
|
c006e017-d15d-4856-b439-6c619639d76b
| 9
|
private static int extract(final File file)
{
if(file==null || !file.exists()){
setError("error file " +file + " does not exist");
return -1;
}
String s = file.toString();
//s = s.substring(s.length()-3);
if(s.toLowerCase().endsWith("cbz")
|| s.toLowerCase().equalsIgnoreCase("zip")) {
s = null;
try( ByteArrayOutputStream os = new ByteArrayOutputStream();
FileInputStream fin = new FileInputStream(file);
) {
try (ZipInputStream zin = new ZipInputStream(fin);
) {
ZipEntry entry = zin.getNextEntry();
while(entry != null) {
File f = new File(appDir);
//os = new ByteArrayOutputStream();
//System.out.println("entryname " + entry.getName());
os.reset();
File ff = f;
if (entry.isDirectory()) {
ff = new File(f.getAbsolutePath()+"/"+entry.getName());
ff.mkdirs();
ff.deleteOnExit();
entry = zin.getNextEntry();
continue;
}
ff.deleteOnExit();
String path = ff.getAbsolutePath()+"/"+entry.getName();
//ff.mkdirs();
ff = new File(path);
ff.deleteOnExit();
byte[] buffer = new byte[1024];
int length;
try (FileOutputStream fout = new FileOutputStream(ff)) {
while( (length = zin.read(buffer)) > 0)
{
os.write(buffer, 0, length);
}
fout.write(os.toByteArray());
if(ff != null)
addFile(ff);
}
entry = zin.getNextEntry();
}
}
}
catch(IOException e) {
setError(e.getMessage());
return -1;
}finally{
}
}
return 0;
}
|
3d880164-6432-4604-a5b3-463592a01e7f
| 0
|
public JoinIterable(Iterable<T> outer, Iterable<TInner> inner, Selector<T, TKey> outerKeySelector, Selector<TInner, TKey> innerKeySelector, Joint<T, TInner, TResult> joint, Comparator<TKey> comparator)
{
this._outer = outer;
this._inner = inner;
this._innerKeySelector = innerKeySelector;
this._outerKeySelector = outerKeySelector;
this._joint = joint;
this._comparator = comparator;
}
|
8eb85735-cef8-4fc8-afcd-5d61abd89e2f
| 0
|
public Allen()
{
super("Allen", 12000, 200, 50, 120, as);
as.setSkill(0, "HaHa", 150, 60, "Allen laughs maniacally at his enemy.");
as.setSkill(1, "Leap Attack", 600, 200, "Allen leaps into the air and lands on his enemy.");
as.setSkill(2, "Crush", 1000, 300, "Allen crushes his enemy.");
as.setSkill(3, "Avatar", 5000, 600, "Allen turns into an unstoppable avatar.");
}
|
14d3669e-60ac-44e1-8ff7-fe1b8cd7175f
| 2
|
public void updateDecreasedElement(E element) {
int i = heap.indexOf(element);
while (i > 0 && heap.get(parent(i)).compareTo(element) > 0) {
swapElementsByIndex(i, parent(i));
i = parent(i);
}
}
|
e24617e7-5995-4c77-8120-7299781c5b02
| 9
|
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we reach an early end, bail.
*/
for (i = 0; i < length; i += 1) {
c = next();
if (c == 0) {
return false;
}
circle[i] = c;
}
/*
* We will loop, possibly for all of the remaining characters.
*/
for (;;) {
j = offset;
b = true;
/*
* Compare the circle buffer with the to string.
*/
for (i = 0; i < length; i += 1) {
if (circle[j] != to.charAt(i)) {
b = false;
break;
}
j += 1;
if (j >= length) {
j -= length;
}
}
/*
* If we exit the loop with b intact, then victory is ours.
*/
if (b) {
return true;
}
/*
* Get the next character. If there isn't one, then defeat is ours.
*/
c = next();
if (c == 0) {
return false;
}
/*
* Shove the character in the circle buffer and advance the
* circle offset. The offset is mod n.
*/
circle[offset] = c;
offset += 1;
if (offset >= length) {
offset -= length;
}
}
}
|
65b7cdd5-a05f-4042-844d-cd9bf2be0483
| 9
|
public synchronized Object put(Object pathSpec, Object object)
{
StringTokenizer tok = new StringTokenizer(pathSpec.toString(),__pathSpecSeparators);
Object old =null;
while (tok.hasMoreTokens())
{
String spec=tok.nextToken();
if (!spec.startsWith("/") && !spec.startsWith("*."))
{
log.warn("PathSpec "+spec+". must start with '/' or '*.'");
spec="/"+spec;
}
old = super.put(spec,object);
// Make entry that was just created.
Entry entry = new Entry(spec,object);
if (entry.getKey().equals(spec))
{
if (spec.equals("/*"))
_prefixDefault=entry;
else if (spec.endsWith("/*"))
{
_prefixMap.put(spec.substring(0,spec.length()-2),entry);
_exactMap.put(spec.substring(0,spec.length()-1),entry);
_exactMap.put(spec.substring(0,spec.length()-2),entry);
}
else if (spec.startsWith("*."))
_suffixMap.put(spec.substring(2),entry);
else if (spec.equals("/"))
{
if (_nodefault)
_exactMap.put(spec,entry);
else
{
_default=entry;
_defaultSingletonList=
SingletonList.newSingletonList(_default);
}
}
else
_exactMap.put(spec,entry);
}
}
return old;
}
|
257ec574-5882-4cc1-9b71-ebc8e7b262ed
| 0
|
private void jButtonSuivActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSuivActionPerformed
//Récupération de la méthode contrôleur 'suivant'
((CtrlVisiteurs)controleur).suivant();
}//GEN-LAST:event_jButtonSuivActionPerformed
|
bc779d6f-c765-4f11-9eaf-483472ce2b6e
| 5
|
protected OgexSkeleton toSkeleton( DataStructure ds, Map<BaseStructure, Object> index ) {
OgexSkeleton result = new OgexSkeleton();
for( BaseStructure child : ds ) {
if( StructTypes.TRANSFORM.equals(child.getType()) ) {
// Not a normal transform
float[][] array = (float[][])child.getData();
result.setTransforms(array);
} else if( StructTypes.BONE_REF_ARRAY.equals(child.getType()) ) {
BaseStructure[] array = (BaseStructure[])child.getData();
//BoneNode[] boneNodes = new OgexBoneNode[array.length]; // FIXME when OGEX is fixed
OgexNode[] boneNodes = new OgexNode[array.length];
for( int i = 0; i < array.length; i++ ) {
if( !StructTypes.BONE_NODE.equals(array[i].getType()) ) {
// Put back in when OGEX is fixed
//throw new RuntimeException("BoneNodeRef array at:" + child.location()
// + " points to non-OgexBoneNode at index:" + i
// + ", node structure:" + array[i]);
boneNodes[i] = toNode((DataStructure)array[i], index);
} else {
boneNodes[i] = toBoneNode((DataStructure)array[i], index);
}
}
result.setBoneNodes(boneNodes);
} else {
log.warn("Unhandled structure type:" + child.getType() + ", from:" + child.location());
}
}
return result;
}
|
9ccc9883-b369-4b30-8ae9-611d04319c98
| 8
|
public static void DoTurn(PlanetWars pw) {
//notice that a PlanetWars object called pw is passed as a parameter which you could use
//if you want to know what this object does, then read PlanetWars.java
//create a source planet, if you want to know what this object does, then read Planet.java
Planet source = null;
//create a destination planet
Planet dest = null;
//(1) implement an algorithm to determine the source planet to send your ships from
//Here, we choose the planet with the maximum of ships to send the fleet (not the best strategy)
int maxShips = 0;
for (Planet p : pw.MyPlanets()){
if (p.NumShips() > maxShips){
maxShips = p.NumShips();
source = p;
}
}
if (source==null){
source = pw.MyPlanets().get(0);
}
//(2) implement an algorithm to deterimen the destination planet to send your ships to
//Here, we'll pick the first available (=capturable) planet in the list of interesting planets
List<Planet> sortedPlanets = interestingPlanets(pw);
for (Planet p : sortedPlanets){
if (Helper.WillCapture(source,p)){
dest = p;
break;
}
}
if (dest==null){
dest = sortedPlanets.get(0);
}
//(3) Attack
if (source != null && dest != null) {
pw.IssueOrder(source, dest);
}
}
|
0befd0f4-4deb-4a88-ae18-ca525f8483cb
| 4
|
@Override
public GameState choose(Player player, GameState[] states, Card card) {
for(GameState s : states)
{
s = findSetToTrue(s,card);
}
//If there's only one choice, we have no choice but to do it
if(states.length == 1)
{
return states[0];
}
int alpha = Integer.MIN_VALUE;
int beta = Integer.MAX_VALUE;
GameState choice = null;
//We perform alpha beta search on each state to see if
//it's the best
for(GameState s : states)
{
int check = alphabeta(new GameState(s), alpha, beta,
player.getFaction(), maxDepth);
System.out.println("\ncheck: " + check);
//Check to see if this state is better
if(check > alpha)
{
alpha = check;
choice = s;
}
}
return choice;
}
|
5e4b4bcb-0008-4153-aa30-b183daa2c739
| 0
|
public static void main(String[] args){
int op;
System.out.println("=MENU DE OPÇÕES DO PROGRAMA=");
System.out.println("1 - Criar Despesa");
System.out.println("2 - Criar Tipo Despesa");
System.out.println("3 - .....");
System.out.println("4 - Resgistar Despesa");
System.out.println("Qual a sua opção? ");
op = ler.nextInt();
ler.nextLine();
}
|
7fc79d5b-5452-4700-9832-52036048cd20
| 3
|
@Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
Value val1 = ((AbsValueNode) getChildAt(0)).evaluate(context);
if (getChildAt(0) instanceof ThingVNode && val1.getType() == VariableType.ARRAYLIST) {
if (((ArrayList<Value>) val1.getValue()).isEmpty()) {
throw new InterpretationException(InterpretationErrorType.EMPTY_LIST, line, null);
} else {
ArrayList<Value> list = ((ArrayList<Value>) val1.getValue());
list.remove(list.size() - 1);
return context;
}
} else {
throw new InterpretationException(InterpretationErrorType.UNDEFINED_VARIABLE, line, null);
}
}
|
0952f931-2f25-4680-8e6b-45fab65dd320
| 6
|
static boolean WordSize() {
//Remove words that are the wrongsize
String i = JOptionPane.showInputDialog(null, "Please select word legnth (4 - 11)", JOptionPane.ERROR_MESSAGE);
if (i.equals("4") || i.equals("5") || i.equals("6") || i.equals("7") || i.equals("8") || i.equals("9")) {
System.out.println("[+] Deleteing words that are not " + i + " chars long.");
Hangman.d.DeleteDifferentSize(Integer.parseInt(i));
System.out.println("List Size: " + Hangman.d.size());
System.out.println(Hangman.d.ViewDict());
return true;
}
else {
//if wrong word length
System.out.println("Error");
return false;
}
}
|
0d177b6b-bfe8-4977-add7-ac4a96b16358
| 7
|
private void btnUnionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUnionActionPerformed
JFileChooser saveFile = new JFileChooser();
int selected = saveFile.showOpenDialog(this);
if(selected == JFileChooser.APPROVE_OPTION){
String path = saveFile.getSelectedFile().getAbsolutePath();
File tempFile = new File(path);
if(!tempFile.exists() || tempFile.isDirectory()){
JOptionPane.showMessageDialog(this, "The current selected path is invalid.",
"Invalid Path", JOptionPane.ERROR_MESSAGE);
return;
}
AFProcessing UnionAFManager = new AFProcessing();
try {
UnionAFManager.processXML(tempFile);
} catch (JAXBException ex) {
invalidAFLoaded("Error parsing xml file.");
}
String error = UnionAFManager.validateAF();
if(!error.isEmpty()){
JOptionPane.showMessageDialog(this,error, "Error At parsing XML", JOptionPane.ERROR_MESSAGE);
return;
}
saveFile = new JFileChooser();
selected = saveFile.showSaveDialog(this);
if(selected == JFileChooser.APPROVE_OPTION){
path = saveFile.getSelectedFile().getAbsolutePath();
try {
AFManager.generateUnionWithCurrentAndAFContent(UnionAFManager.getContent(), path);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}//GEN-LAST:event_btnUnionActionPerformed
|
984a936f-f06e-40d2-aae6-f78c40be19cd
| 5
|
public Aim getBestDirection(Tile tile) {
int value = 0;
int max = -100;
omaArrayList<Aim> helpTable = new omaArrayList<Aim>();
omaArrayList<Aim> directions = getMovableDirections(tile);
if (directions.size() == 0) {
return null;
}
for (int i = 0; i < directions.size(); i++) {
value = getMoveValue(tile, directions.get(i));
if (max < value) {
max = value;
helpTable = new omaArrayList<Aim>();
helpTable.add(directions.get(i));
} else if (max == value) {
helpTable.add(directions.get(i));
}
}
if (helpTable.size() == 1) {
return helpTable.get(0);
} else {
return getRandomDirection(helpTable);
}
}
|
4098c99b-5bdf-453a-8f8a-2d13942f5c6e
| 1
|
public void generate()
{
System.out.println("Generate is called!");
set = Set.getSet(random.nextInt(Set.maxSets()));
for (int i = 0; i < set.entities.length; i++)
{
Entity e = set.entities[i];
e.move(0, height + 10);
spawnEntity(e, true, i);
}
}
|
c08c52ed-c983-47a4-9c33-0d69085c1293
| 9
|
public static void inorder(TreeNode root) {
if (root == null)
return;
TreeNode previous = null;
Stack<TreeNode> S = new Stack<TreeNode>();
S.push(root);
while (!S.empty()) {
//get current node from the stack
TreeNode current = S.peek();
//going down the tree
if (previous == null
|| previous.left == current
|| previous.right == current) {
if(current.left != null)
S.push(current.left);
else if (current.right != null) {
current.print();
S.push(current.right);
} else {
current.print();
S.pop();
}
}
//if we are at root node after traversing left sub tree.
//print root and go to right subtree
else if (current.left == previous) {
if (current.right != null) {
current.print();
S.push(current.right);
} else {
current.print();
S.pop();
}
}
//no further node
else
S.pop();
previous = current;
}//end of while
System.out.println();
}
|
795eb5ee-348d-40cb-b51c-5acb13a0c423
| 2
|
private void back() {
if (mUsePrevious || mIndex <= 0) {
throw new IllegalStateException("Stepping back two steps is not supported"); //$NON-NLS-1$
}
mIndex--;
mCharacter--;
mUsePrevious = true;
mEOF = false;
}
|
892db720-a688-426b-8682-79ebcd544002
| 3
|
private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
plugin.getLogger().log(Level.SEVERE, null, e);
}
}
}
|
733bc03f-ebdd-4f73-91af-73d0a2b0a0fd
| 0
|
public void setInternalObject(Object internalObject) {
this.internalObject = internalObject;
}
|
de859b4f-bc80-49fc-9af1-2bd045892974
| 1
|
public static ResultSet listeMetaDonneesParTitre(String titre) {
Connection connexion;
java.sql.Statement requete;
ResultSet resultat = null;
try {
Class.forName("org.sqlite.JDBC");
connexion = DriverManager.getConnection("jdbc:sqlite:dbged");
requete = connexion.createStatement();
resultat = requete.executeQuery("select * from images where nom='"
+ titre + "'");
return resultat;
} catch (Exception e) {
e.printStackTrace();
}
return resultat;
}
|
c4c941f2-99ed-4399-aa28-a7bb80152a6d
| 8
|
@Override
public void configure(Configuration jobConf) {
if (parameters == null) {
ParameteredGeneralizations.configureParameters(this, jobConf);
}
try {
if (inverseCovarianceFile.get() != null) {
FileSystem fs = FileSystem.get(inverseCovarianceFile.get().toUri(), jobConf);
MatrixWritable inverseCovarianceMatrix =
ClassUtils.instantiateAs((Class<? extends MatrixWritable>) matrixClass.get(), MatrixWritable.class);
if (!fs.exists(inverseCovarianceFile.get())) {
throw new FileNotFoundException(inverseCovarianceFile.get().toString());
}
DataInputStream in = fs.open(inverseCovarianceFile.get());
try {
inverseCovarianceMatrix.readFields(in);
} finally {
Closeables.closeQuietly(in);
}
this.inverseCovarianceMatrix = inverseCovarianceMatrix.get();
Preconditions.checkArgument(this.inverseCovarianceMatrix != null, "inverseCovarianceMatrix not initialized");
}
if (meanVectorFile.get() != null) {
FileSystem fs = FileSystem.get(meanVectorFile.get().toUri(), jobConf);
VectorWritable meanVector =
ClassUtils.instantiateAs((Class<? extends VectorWritable>) vectorClass.get(), VectorWritable.class);
if (!fs.exists(meanVectorFile.get())) {
throw new FileNotFoundException(meanVectorFile.get().toString());
}
DataInputStream in = fs.open(meanVectorFile.get());
try {
meanVector.readFields(in);
} finally {
Closeables.closeQuietly(in);
}
this.meanVector = meanVector.get();
Preconditions.checkArgument(this.meanVector != null, "meanVector not initialized");
}
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
|
eefc4276-2e5b-4981-ba42-6b5cf82df446
| 2
|
public boolean fileToArrayList(String fileName, ArrayList<String> listArr) {
out.println("[+++]\tReading File (" + fileName + ")");
BufferedReader br = new BufferedReader(new InputStreamReader(FileReader.class.getResourceAsStream(fileName)));
String line = "";
try {
while( (line = br.readLine()) != null) {
listArr.add(line);
}
} catch (IOException ex) {
ex.printStackTrace();
}
Collections.shuffle(listArr);
return true;
}
|
9dcd76cb-1989-4595-a90c-fbee313e1e40
| 5
|
private List<Gate> getAugGates() {
List<Gate> res = new ArrayList<Gate>();
int gateNumber = 0;
List<Gate> andGates = new ArrayList<Gate>();
/**
* Add all the AND gates. We assume r is the 3rd input
*/
for (int i = 0; i < l; i++) {
for (int x = 0; x < t_a; x++) {
int leftWire = r + i + x;
int rightWire = x;
int outputWire = numberOfNewInputs + i * t_a + x;
Gate g = new Gate("2 1 "+ leftWire + " " + rightWire +
" " + outputWire + " 0001", InputGateType.FAIRPLAY);
largestAugOutputWire = Math.max(largestAugOutputWire, g.getOutputWireIndex());
g.setGateNumber(gateNumber++);
andGates.add(g);
}
res.addAll(andGates);
numberOfNonXORGatesAdded += andGates.size();
andGates.clear();
}
/**
* Add all the XOR gates (both for inner product and final xor).
*/
List<Gate> xorGates = new ArrayList<Gate>();
//How far we filled up the res array with andGates
int xorWireStart = largestAugOutputWire + 1;
for (int i = 0; i < l; i++) {
int priorOutputWire = 0;
for (int x = 1; x < t_a; x++) { // Start x from 1 because we need one less xor per layer
int leftWire;
int rightWire = numberOfNewInputs + t_a * i + x;
if (x == 1){
leftWire = numberOfNewInputs + t_a * i + x - 1;
} else {
leftWire = priorOutputWire;
}
int outputWire = xorWireStart + (x - 1) + i * (t_a - 1);
priorOutputWire = outputWire;
// We make each xor dependant on the following xor, thus
// creating a chain structure. The last gate in this list is the
// output gate.
Gate g = new Gate("2 1 " + leftWire + " " +
rightWire + " " + outputWire + " 0110", InputGateType.FAIRPLAY);
largestAugOutputWire = Math.max(largestAugOutputWire, g.getOutputWireIndex());
xorGates.add(g);
}
//We identify the last xor-gate of the chain and xor this
//with the current bit of s. The output of this xor is the s'th
//output bit of the augmentation output.
Gate xorOutputGate = xorGates.get(xorGates.size() - 1);
int xorOutputWireIndex = xorOutputGate.getOutputWireIndex();
int s = t_a + i;
Gate outputGate = new Gate("2 1 " + xorOutputWireIndex + " " +
s + " " + i + " 0110", InputGateType.FAIRPLAY);
outputGates.add(outputGate);
res.addAll(xorGates);
xorGates.clear();
}
return res;
}
|
96b35d0c-8c19-45fc-a194-78deaf7d671b
| 4
|
@Override
public iDriver orderBy(HashMap<String, String> fields) {
if (fields.size() > 0) {
String SQL = "ORDER BY ";
int i = 0;
for (Map.Entry<String, String> field : fields.entrySet()) {
if (i > 0)
SQL += ", ";
SQL += field.getKey()
+ " "
+ ((field.getValue().equalsIgnoreCase("ASC")) ? "ASC"
: "DESC");
i++;
}
this.buildQuery(SQL + " \n", true, false, false);
}
return this;
}
|
39ed943e-73cb-4383-b5d8-4853cbfa6128
| 1
|
@Override
public void setValues(AnimatedScore target, int tweenType, float[] newValues) {
switch(tweenType) {
case ALPHA:
target.setColor(target.getColor().r, target.getColor().g, target.getColor().b, newValues[0]);
break;
default:
assert false;
}
}
|
c7704ae0-af6d-493b-bed9-af34463c08b0
| 4
|
private int getLeftPositionForRow(int rowNumber) {
if (rowNumber == 0 || rowNumber == NUMBER_OF_ROWS - 1) {
return CARD_DISPLAY_LEFT + cardWidth;
}
if (rowNumber == 1 || rowNumber == NUMBER_OF_ROWS - 2) {
return CARD_DISPLAY_LEFT + cardWidth / 2;
}
return CARD_DISPLAY_LEFT;
}
|
90f461fa-2fb3-4ce6-8276-1bbc974cf376
| 8
|
public String doLogin() {
String destino = null;
if (((dni == null) && (numeroColegiado == null)) || (password == null)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "No se ha indicado un DNI ó un número de colegiado o una contraseña", ""));
} else {
Medico medico = null;
if (dni != null) {
medico = medicoDAO.buscarPorDNI(dni);
}
if ((medico == null) && (numeroColegiado != null)) {
medico = medicoDAO.buscarPorNumeroColegiado(numeroColegiado);
}
if (medico == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "No existe ningún médico con los datos indicados", ""));
} else {
if (autenticacionControlador.autenticarUsuario(medico.getId(), password,
TipoUsuario.MEDICO.getEtiqueta().toLowerCase())) {
medicoActual = medico;
destino = "privado/index";
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Credenciales de acceso incorrectas", ""));
}
}
}
return destino;
}
|
fdbeef6e-86b2-4cb0-ae19-e8524dc855a6
| 7
|
public final void performAStarDist(int start, int stop, JPFMap map){
//initialize
if (map==null) return;
Node node = new Node(null, start, map, stop);
PriorityQueue<Node> open = new PriorityQueue<Node>();
//search & visualisation phase
while(node.val != stop){
int[]neighbours=map.getCityNeighbours(node.val); //get ids of neighbouring cities
for (int i : neighbours) {
Node n = new Node(node, i, map, stop);
open.add(n);
}
node=open.poll(); //go to next neighbour
}
Stack<Node> path = new Stack<Node>();
path.push(node);
while(node.parent != null){
node = node.parent;
path.push(node);
}
finder.inform("Path Discovered!");
if(path.size() == 1){
Node n = path.pop();
map.drawPath(n.val,n.val,Color.PINK);
}
Node act = path.pop();
Node next = path.pop();
while(!path.empty()){
map.drawPath(act.val, next.val); //draw a line from the parent to the selected node (visualisation purposes)
map.highlightCities(new int[]{next.val}, Color.cyan); //highlight the selected node (visualisation purposes)
finder.inform("Going to " + next.val);
act = next;
next = path.pop();
try {
Thread.sleep(100); //wait or a while so that the search can be seen in the visualisation (visualisation purposes)
} catch (InterruptedException ex) {/**/}
}
map.drawPath(act.val, next.val); //draw a line from the parent to the selected node (visualisation purposes)
map.highlightCities(new int[]{next.val}, Color.cyan); //highlight the selected node (visualisation purposes)
finder.inform("Going to " + next.val);
}
|
24c63bad-4140-45d9-8778-caca30b51f6c
| 4
|
public static long dateToJavaMilliS(int year, int month, int day, int hour, int min, int sec){
long[] monthDays = {0L, 31L, 28L, 31L, 30L, 31L, 30L, 31L, 31L, 30L, 31L, 30L, 31L};
long ms = 0L;
long yearDiff = 0L;
int yearTest = year-1;
while(yearTest>=1970){
yearDiff += 365;
if(Fmath.leapYear(yearTest))yearDiff++;
yearTest--;
}
yearDiff *= 24L*60L*60L*1000L;
long monthDiff = 0L;
int monthTest = month -1;
while(monthTest>0){
monthDiff += monthDays[monthTest];
if(Fmath.leapYear(year))monthDiff++;
monthTest--;
}
monthDiff *= 24L*60L*60L*1000L;
ms = yearDiff + monthDiff + day*24L*60L*60L*1000L + hour*60L*60L*1000L + min*60L*1000L + sec*1000L;
return ms;
}
|
eced3d28-3322-40d8-a8e8-03010d81eecd
| 4
|
@Override
public void draw() {// draws to image
int minX = Math.min(startX, endX);
int minY = Math.min(startY, endY);
int maxX = Math.max(startX, endX);
int maxY = Math.max(startY, endY);
int width = maxX - minX;
int height = maxY - minY;
Graphics2D g = (Graphics2D) canvas.getLayers()[canvas.getLayerSelected()].getGraphics();
canvas.setGraphicsDetails(g);
switch (shape) {
case "Draw Rectangle":
g.drawRect(minX, minY, width, height);
break;
case "Fill Rectangle":
g.fillRect(minX, minY, width, height);
break;
case "Draw Oval":
g.drawOval(minX, minY, width, height);
break;
case "Fill Oval":
g.fillOval(minX, minY, width, height);
break;
}
canvas.repaint();
}
|
862f3a5e-bbb3-432e-8907-a41782c8c777
| 9
|
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = source.getBounds();
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
MediaLibAccessor srcAccessor =
new MediaLibAccessor(source,srcRect,formatTag);
MediaLibAccessor dstAccessor =
new MediaLibAccessor(dest,destRect,formatTag);
//
// The AffineTransform needs to be readjusted as per the
// location of the current source & destination rectangles
//
// Clone the global transform so as not to write to an instance
// variable as this method may be called from different threads.
double[] medialib_tr = (double[])this.medialib_tr.clone();
medialib_tr[2] = m_transform[0] * srcRect.x +
m_transform[1] * srcRect.y +
m_transform[2] -
destRect.x;
medialib_tr[5] = m_transform[3] * srcRect.x +
m_transform[4] * srcRect.y +
m_transform[5] -
destRect.y;
mediaLibImage srcML[], dstML[];
switch (dstAccessor.getDataType()) {
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_INT:
srcML = srcAccessor.getMediaLibImages();
dstML = dstAccessor.getMediaLibImages();
if (setBackground)
Image.Affine2(dstML[0],
srcML[0],
medialib_tr,
Constants.MLIB_BILINEAR,
Constants.MLIB_EDGE_DST_NO_WRITE,
intBackgroundValues);
else
Image.Affine(dstML[0],
srcML[0],
medialib_tr,
Constants.MLIB_BILINEAR,
Constants.MLIB_EDGE_DST_NO_WRITE);
MlibUtils.clampImage(dstML[0], getColorModel());
break;
case DataBuffer.TYPE_FLOAT:
case DataBuffer.TYPE_DOUBLE:
srcML = srcAccessor.getMediaLibImages();
dstML = dstAccessor.getMediaLibImages();
if (setBackground)
Image.Affine2_Fp(dstML[0],
srcML[0],
medialib_tr,
Constants.MLIB_BILINEAR,
Constants.MLIB_EDGE_DST_NO_WRITE,
backgroundValues);
else
Image.Affine_Fp(dstML[0],
srcML[0],
medialib_tr,
Constants.MLIB_BILINEAR,
Constants.MLIB_EDGE_DST_NO_WRITE);
break;
default:
String className = this.getClass().getName();
throw new RuntimeException(JaiI18N.getString("Generic2"));
}
if (dstAccessor.isDataCopy()) {
dstAccessor.copyDataToRaster();
}
}
|
ed7e09b3-4267-42cb-b745-2e64cd70253e
| 7
|
public void testKeySetRemoveAllArray() {
int element_count = 20;
int[] keys = new int[element_count];
String[] vals = new String[element_count];
TIntObjectMap<String> map = new TIntObjectHashMap<String>();
for ( int i = 0; i < element_count; i++ ) {
keys[i] = i + 1;
vals[i] = Integer.toString( i + 1 );
map.put( keys[i], vals[i] );
}
assertEquals( element_count, map.size() );
TIntCollection keyset = map.keySet();
for ( int i = 0; i < keyset.size(); i++ ) {
assertTrue( keyset.contains( keys[i] ) );
}
assertFalse( keyset.isEmpty() );
int[] other = {1138};
assertFalse( "collection: " + keyset + ", should be unmodified. array: " +
Arrays.toString( vals ), keyset.removeAll( other ) );
other = new int[element_count - 1];
for ( int i = 0; i < element_count; i++ ) {
if ( i < 5 ) {
other[i] = i + 1;
}
if ( i > 5 ) {
other[i - 1] = i + 1;
}
}
assertTrue( "collection: " + keyset + ", should be modified. array: " +
Arrays.toString( other ), keyset.removeAll( other ) );
assertEquals( 1, keyset.size() );
for ( int i = 0; i < element_count; i++ ) {
if ( i == 5 ) {
assertTrue( keyset.contains( keys[i] ) );
assertTrue( map.containsKey( keys[i] ) );
assertTrue( map.containsValue( vals[i] ) );
} else {
assertFalse( keyset.contains( keys[i] ) );
assertFalse( map.containsKey( keys[i] ) );
assertFalse( map.containsValue( vals[i] ) );
}
}
}
|
080a2a0d-151c-4a4d-b916-59ae089abc4e
| 3
|
private Class<?> getTypeClass() {
Class<?> clazz = (Class<?>) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[1];
return clazz;
}
|
55447427-9cfb-4930-beb4-17eed1d0c137
| 8
|
void parseConditionalSect() throws java.lang.Exception
{
skipWhitespace();
if (tryRead("INCLUDE")) {
skipWhitespace();
require('[');
skipWhitespace();
while (!tryRead("]]>")) {
parseMarkupdecl();
skipWhitespace();
}
} else if (tryRead("IGNORE")) {
skipWhitespace();
require('[');
int nesting = 1;
char c;
for (int nest = 1; nest > 0;) {
c = readCh();
switch (c) {
case '<':
if (tryRead("![")) {
nest++;
}
case ']':
if (tryRead("]>")) {
nest--;
}
}
}
} else {
error("conditional section must begin with INCLUDE or IGNORE",
null, null);
}
}
|
8abd845e-8b6b-4d76-8720-af3e142035d4
| 2
|
public void sendMessage(String cmsg) {
ArrayList<Participant> participants = participantList.getParticipants();
Participant receiver;
String msg;
for(int k=0; k<participants.size(); ++k) {
receiver = participants.get(k);
if(receiver.isOnline()) {
msg = JsonTools.createChatMessage(settings.getProperty("name"), cmsg);
updtools.sendMsg(receiver.getInetAddress(), msg.getBytes());
}
}
}
|
0d3180c2-916d-4892-bf5e-7939a6adf58d
| 6
|
public BITalinoFrame[] read(final int[] analogChannels, final int totalBytes,
final int numberOfSamples) throws BITalinoException {
try {
BITalinoFrame[] frames = new BITalinoFrame[numberOfSamples];
byte[] buffer = new byte[totalBytes];
byte[] bTemp = new byte[1];
int sampleCounter = 0;
// parse frames
while (sampleCounter < numberOfSamples) {
// read number_bytes from buffer
dis.readFully(buffer, 0, totalBytes);
// let's try to decode the buffer
BITalinoFrame f = BITalinoFrameDecoder.decode(buffer, analogChannels, totalBytes);
// if CRC isn't valid, sequence equals -1
if (f.getSequence() == -1) {
// we're missing data, so let's wait and try to rebuild the buffer or
// throw exception
System.out
.println("Missed a sequence. Are we too far from BITalino? Retrying..");
while (f.getSequence() == -1) {
dis.readFully(bTemp, 0, 1);
for (int j = totalBytes - 2; j >= 0; j--)
buffer[j + 1] = buffer[j];
buffer[0] = bTemp[0];
f = BITalinoFrameDecoder.decode(buffer, analogChannels, totalBytes);
}
} else if (f.getSequence() != (prevSeq + 1) % 16) {
System.out.println("Sequence out of order.");
}
prevSeq = f.getSequence();
frames[sampleCounter] = f;
sampleCounter++;
}
return frames;
} catch (Exception e) {
throw new BITalinoException(BITalinoErrorTypes.LOST_COMMUNICATION);
}
}
|
97998179-fee3-47fa-a0cb-573d818851d1
| 5
|
public static void main(String[] args) {
final BlockingQueue queue = new ArrayBlockingQueue(3);
for(int i=0;i<2;i++){
new Thread(){
@Override
public void run(){
while(true){
try {
Thread.sleep((long)(Math.random()*1000));
System.out.println(Thread.currentThread().getName() + "准备放数据!");
queue.put(1);
System.out.println(Thread.currentThread().getName() + "已经放了数据," +
"队列目前有" + queue.size() + "个数据");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
new Thread(){
@Override
public void run(){
while(true){
try {
//将此处的睡眠时间分别改为100和1000,观察运行结果
Thread.sleep(2000);
System.out.println(Thread.currentThread().getName() + "准备取数据!");
queue.take();
System.out.println(Thread.currentThread().getName() + "已经取走数据," +
"队列目前有" + queue.size() + "个数据");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
|
09d9787e-d106-4a20-9d16-9b4e6a89df09
| 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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmCircunferencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmCircunferencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmCircunferencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmCircunferencia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frmCircunferencia().setVisible(true);
}
});
}
|
42fa60df-0b92-4a0c-af27-d997a50d2d68
| 8
|
public mxRectangle graphModelChanged(mxIGraphModel sender,
List<mxUndoableChange> changes)
{
int thresh = getChangesRepaintThreshold();
boolean ignoreDirty = thresh > 0 && changes.size() > thresh;
// Ignores dirty rectangle if there was a root change
if (!ignoreDirty)
{
Iterator<mxUndoableChange> it = changes.iterator();
while (it.hasNext())
{
if (it.next() instanceof mxRootChange)
{
ignoreDirty = true;
break;
}
}
}
mxRectangle dirty = processChanges(changes, true, ignoreDirty);
view.validate();
if (isAutoOrigin())
{
updateOrigin();
}
if (!ignoreDirty)
{
mxRectangle tmp = processChanges(changes, false, ignoreDirty);
if (tmp != null)
{
if (dirty == null)
{
dirty = tmp;
}
else
{
dirty.add(tmp);
}
}
}
removeSelectionCells(getRemovedCellsForChanges(changes));
return dirty;
}
|
0c94de08-b09d-4339-a0f2-52a6989c47f7
| 7
|
public LinkedList<TailStack<Integer>> search(int size) {
LinkedList<TailStack<Integer>> mappers = new LinkedList<TailStack<Integer>>();
LinkedList<TailStack<Integer>> s = new LinkedList<TailStack<Integer>>();
s.push(new TailStack<Integer>());
LinkedList<Integer> allNums = new LinkedList<Integer>();
for (int i = 0; i < size; i++)
allNums.add(i);
TailStack<Integer> poped = new TailStack<Integer>();
while (s.size() > 0) {
TailStack<Integer> top = s.peek();
boolean breakit = false;
for (Integer i : allNums) {
if (top.contains(i))
continue;
TailStack<Integer> num = new TailStack<Integer>(top);
num.push(i);
if (num.compareTo(poped) > 0) {
s.push(num);
if (num.size() > size - 1) {
mappers.add(num);
}
breakit = true;
break;
}
}
if (!breakit)
poped = s.pop();
}
return mappers;
}
|
769c1808-dfa2-4685-8b51-20b47e576394
| 7
|
public static Line closestPair(ArrayList<Point> xPoints, ArrayList<Shapes.Point> yPoints, ArrayList<Shapes.Point> aux,
int left, int right, Line s0) {
if (left >= right) {
return new Line(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
}
int middle = ((right + left) >> 1) + ((right + left) % 2);
Shapes.Point mPoint = xPoints.get(middle);
Line lS;
lS = closestPair(xPoints, yPoints, aux, left, middle - 1, s0);
Line rS;
rS = closestPair(xPoints, yPoints, aux, middle + 1, right, s0);
Line s = lS.compare(rS).compare(s0);
int index = 0;
for (int i = left; i <= right; i++) {
if ((Math.abs((new Line(yPoints.get(i), mPoint)).getSize())) < (s.getSize())) {
aux.add(index++, yPoints.get(i));
}
}
for (int i = 0; i < index; i++) {
for (int j = i + 1; (j < index) && (aux.get(i).getY() - aux.get(j).getY()) <
(s.getSize()); j++) {
if (((new Line(aux.get(i), aux.get(j))).getSize()) < (s.getSize())) {
s = new Line(aux.get(i), aux.get(j));
}
}
}
return s;
}
|
2d51f49b-5cb7-46e1-bbfe-7ffbcd40518a
| 4
|
public void searchTimetable(Search search)
{
if (timetableURL == null)
{
System.err.println("ERROR: Timetable URL is null");
timetableResults = null;
return;
}
String postDataString = generatePostDataString(search);
String result = null;
try
{
//Open connection to the Timetable
URL url = new URL(timetableURL);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
//Send the POST Data to the Timetable
OutputStreamWriter writer =
new OutputStreamWriter(connection.getOutputStream());
writer.write(postDataString);
writer.flush();
//Read the Timetable data
//using the BufferedReader readline method
BufferedReader reader =
new BufferedReader(
new InputStreamReader(connection.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null) {
result += line; //add each line to the 'result' string
}
//Close open streams
writer.close();
reader.close();
}
catch (MalformedURLException e)
{
System.err.println("ERROR: MalformedURLException ocurred " +
"when trying to open a connection to the Timetable");
}
catch (IOException e)
{
System.err.println("ERROR: IOException ocurred when trying to " +
"connect to, output to, or read from the Timetable URL");
}
timetableResults = result;
}
|
2b6d7e17-365c-4295-87b6-4bb8a9c6c672
| 7
|
private void loadModuleConfigs() {
if (enableKits) {
kitConfig = new KitConfig(main, MODULE_NAME_KITS);
}
if (enableGetPayed) {
getPayedConfig = new GetPayedConfig(main, MODULE_NAME_GETPAYED);
}
if (enableTNTControl) {
tntControlConfig = new TNTControlConfig(main, MODULE_NAME_TNT_CONTROL);
}
if (enableAutoStopServer) {
autoStopServerConfig = new AutoStopServerConfig(main, MODULE_NAME_AUTO_STOP_SERVER);
}
if (enableAttackControl) {
attackControlConfig = new AttackControlConfig(main, MODULE_NAME_ATTACKCONTROL);
}
if (enableRARP) {
rarpConfig = new RARPConfig(main, MODULE_NAME_RARP);
}
if (enableCreativeSwitch) {
creativeSwitchConfig = new CreativeSwitchConfig(main, MODULE_NAME_CREATIVE_SWITCH);
}
// ToDo after enabling the module make it available
}
|
d9ea1b38-cbf5-4e65-b91d-f5f4b1240653
| 9
|
@Override
public void onLoad(OnLoadCallback pOnLoadCallback) throws Exception {
final Font defaultFont32 = ResourceManager.getInstance().getDefaultFont32();
// Username
this.mUserNameLabel = new Text(RegisterLayer.PADDING_DEFAULT,
RegisterLayer.PADDING_DEFAULT * 4, defaultFont32, Constants.ORANGE_COLOR_DEFAULT, Constants.USERNAME_LABEL_TEXT);
this.mUsernameInput = new TextInput(this.mUserNameLabel.getX(), this.mUserNameLabel.getY() + this.mUserNameLabel.getHeight() + RegisterLayer.PADDING_DEFAULT,
this.mEntity.getWidth() - RegisterLayer.PADDING_DEFAULT * 2, RegisterLayer.TEXTBOX_HEIGHT_DEFAULT,
Color.BLACK, defaultFont32) {
@Override
public void onMouseEvent(final MouseEvent pMouseEvent, final int pMouseAreaLocalX, final int pMouseAreaLocalY) {
if (pMouseEvent.getID() == MouseEvent.MOUSE_CLICKED) {
RegisterLayer.this.mUsernameInput.setFocus(true);
RegisterLayer.this.mPasswordInput.setFocus(false);
RegisterLayer.this.mConfirmPasswordInput.setFocus(false);
}
}
};
// Password
this.mPasswordLabel = new Text(this.mUserNameLabel.getX(),
this.mUsernameInput.getEntity().getY() + this.mUsernameInput.getEntity().getHeight() + RegisterLayer.PADDING_DEFAULT * 4,
defaultFont32, Constants.ORANGE_COLOR_DEFAULT, Constants.PASSWORD_LABEL_TEXT);
this.mPasswordInput = new PasswordInput(this.mUserNameLabel.getX(), this.mPasswordLabel.getY() + this.mPasswordLabel.getHeight() + RegisterLayer.PADDING_DEFAULT,
this.mEntity.getWidth() - RegisterLayer.PADDING_DEFAULT * 2, RegisterLayer.TEXTBOX_HEIGHT_DEFAULT,
Color.BLACK, defaultFont32) {
@Override
public void onMouseEvent(final MouseEvent pMouseEvent, final int pMouseAreaLocalX, final int pMouseAreaLocalY) {
if (pMouseEvent.getID() == MouseEvent.MOUSE_CLICKED) {
RegisterLayer.this.mPasswordInput.setFocus(true);
RegisterLayer.this.mUsernameInput.setFocus(false);
RegisterLayer.this.mConfirmPasswordInput.setFocus(false);
}
}
};
// Confirm Password
this.mConfirmPasswordLabel = new Text(this.mUserNameLabel.getX(),
this.mPasswordInput.getEntity().getY() + this.mPasswordInput.getEntity().getHeight() + RegisterLayer.PADDING_DEFAULT * 4,
defaultFont32, Constants.ORANGE_COLOR_DEFAULT, Constants.CONFIRM_PASSWORD_LABEL_TEXT);
this.mConfirmPasswordInput = new PasswordInput(this.mUserNameLabel.getX(), this.mConfirmPasswordLabel.getY() + this.mConfirmPasswordLabel.getHeight() + RegisterLayer.PADDING_DEFAULT,
this.mEntity.getWidth() - RegisterLayer.PADDING_DEFAULT * 2, RegisterLayer.TEXTBOX_HEIGHT_DEFAULT,
Color.BLACK, defaultFont32) {
@Override
public void onMouseEvent(final MouseEvent pMouseEvent, final int pMouseAreaLocalX, final int pMouseAreaLocalY) {
if (pMouseEvent.getID() == MouseEvent.MOUSE_CLICKED) {
RegisterLayer.this.mConfirmPasswordInput.setFocus(true);
RegisterLayer.this.mPasswordInput.setFocus(false);
RegisterLayer.this.mUsernameInput.setFocus(false);
}
}
};
// Login
this.mButtonLogin = new TextButton(0, 0, Constants.BUTTON_LOGIN_TEXT, ResourceManager.getInstance().getOrangeButtonTextureRegion()) {
@Override
public void onClick() {
ScreenManager.getInstance().showLoginLayer();
}
@Override
public void onKeyEvent(KeyEvent pKeyEvent) {
}
};
this.mButtonLogin.getEntity().setPosition(this.mEntity.getWidth() - this.mButtonLogin.getEntity().getWidth() - RegisterLayer.PADDING_DEFAULT,
this.mEntity.getHeight() - this.mButtonLogin.getEntity().getHeight() - RegisterLayer.PADDING_DEFAULT);
// Register
this.mButtonOk = new TextButton(0, 0, Constants.BUTTON_DONE_TEXT, ResourceManager.getInstance().getOrangeButtonTextureRegion()) {
@Override
public void onClick() {
//ScreenManager.getInstance().showLoadingLayer();
RegisterLayer.this.hide();
if (!isValidText(mUsernameInput.getText()) || !isValidText(mPasswordInput.getText())
|| !mPasswordInput.getText().equals(mConfirmPasswordInput.getText())) {
final BaseDialog.IOnButtonClickedEvent event = new BaseDialog.IOnButtonClickedEvent() {
@Override
public void onButtonClicked() {
ScreenManager.getInstance().showRegistryLayer();
}
};
if (!isValidText(mUsernameInput.getText())) {
ScreenManager.getInstance().showDialog(Constants.DIALOG_USERNAME_INVALID_TEXT, event);
} else if (!isValidText(mPasswordInput.getText())) {
ScreenManager.getInstance().showDialog(Constants.DIALOG_PASSWORD_INVALID_TEXT, event);
} else if (!mPasswordInput.getText().equals(mConfirmPasswordInput.getText())) {
ScreenManager.getInstance().showDialog(Constants.DIALOG_REGISTER_CONFIRM_NOT_MATCH_TEXT, event);
}
return;
}
NetworkManager.getInstance().startListener();
NetworkUtilities.sendRegisterRequest(mUsernameInput.getText(), mPasswordInput.getText());
}
@Override
public void onKeyEvent(KeyEvent pKeyEvent) {
}
};
this.mButtonOk.getEntity().setPosition((this.mEntity.getWidth() - this.mButtonLogin.getEntity().getWidth()) / 2,
this.mEntity.getHeight() - this.mButtonOk.getEntity().getHeight() - RegisterLayer.PADDING_DEFAULT);
// Register Mouse Area
this.mMainScene.registryMouseArea(this.mUsernameInput.getEntity());
this.mMainScene.registryMouseArea(this.mPasswordInput.getEntity());
this.mMainScene.registryMouseArea(this.mConfirmPasswordInput.getEntity());
this.mMainScene.registryMouseArea(this.mButtonLogin.getEntity());
this.mMainScene.registryMouseArea(this.mButtonOk.getEntity());
// Set Position
this.mEntity.setPosition(-this.mEntity.getWidth(),
Constants.SCREEN_HEIGHT - this.getEntity().getHeight() - BaseLayer.PADDING_DEFAULT);
pOnLoadCallback.onLoadFinish();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.