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... |
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()));
... |
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.chil... |
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 dpro... |
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 ca... |
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", ... |
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.
... |
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().toStr... |
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 = "";
ParteDeExpressa... |
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.s... |
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
* in... |
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 : ex... |
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... |
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... |
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 ... |
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";
fo... |
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((byt... |
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)
... |
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... |
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))... |
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 = (((Qu... |
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 !... |
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);
}
... |
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... |
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 c... |
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()... |
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... |
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... |
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();
... |
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 (animatio... |
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 a... |
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()) {
... |
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 ... |
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){
... |
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 = ... |
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.versionLi... |
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.le... |
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... |
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, rest... |
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")
... |
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._outerKeySel... |
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, "Avat... |
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... |
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.s... |
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[][] arr... |
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
... |
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 =... |
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");
... |
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()... |
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("[+] ... |
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().getAbsoluteP... |
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(ti... |
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
... |
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 = requet... |
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);
Mat... |
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()... |
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;
... |
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().equalsI... |
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:
... |
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", "")... |
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){
... |
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)... |
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.getLayerS... |
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);
M... |
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;
... |
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();
... |
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(... |
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[] ... |
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() + "准备放... |
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://down... |
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 =... |
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... |
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... |
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;
... |
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);
}
i... |
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, defaultF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.