method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9910a45b-2330-421a-9a16-3c856b2aa3bf | 3 | public static Keytype parse(HtmlElement element, String str){
switch(str){
case "dsa":
return DSA;
case "ec":
return EC;
case "rsa":
default:
return RSA;
}
} |
b4808590-0bce-4418-b664-5d4c9a56afc9 | 0 | public void setDay(String day) {
this.day = day;
} |
858457b3-38bc-4b82-a0c7-11dceb40bba9 | 2 | public HashMap<String, Integer> getUserStocks(String uid) {
HashMap<String, Integer> userStocks = new HashMap<String, Integer>();;
NodeList userList = doc.getElementsByTagName("user");
System.out.println(userList.getLength());
Node user = getUserNode(uid);
NodeList userNode = us... |
abd6fea7-9277-4e71-bfea-1170ed79d2c3 | 9 | public boolean check(String[] values, String hash){
int len = values.length;
boolean f = false;
for(int i = 0;i<len && !f;i++){
for(int j = 0;j<len && !f;j++){
for(int k = 0;k<len && !f;k++){
for(int n = 0;n<len && !f;n++){
... |
5ad29a8f-ad61-4447-bb88-5b17b3eaf871 | 8 | public void start() {
if (applet != null) {
applet.start();
return;
}
if (gameUpdaterStarted) return;
Thread t = new Thread() {
GameBuilder gamebuilder = new GameBuilder();
public void run() {
gamebuilder.run();
try {
if (!gamebuilder.fatalError)
replace(gamebu... |
748251ec-974a-4dc3-bade-fa67a25e36be | 1 | public static void main(String[] args) {
// Declaramos un valor de enteros
//int [] arreglo1= new int[3];
//System.out.println(arreglo1[0]);
/*int [] algo;
"algo" no se ejecuta si solo se pone: int algo;
este solo se ejecuta si se pone enseguida despues ... |
3c8e9ff6-cda8-479f-b216-0bc941714371 | 9 | public int checkDifficulty() {
ControlroomWorld world = (ControlroomWorld)getWorld();
if(difficultyScore < 300)
{
return 1000;
}
else if (difficultyScore >= 300)
{
return 900;
}
else if (difficultyScore >= 700)
{... |
b8108598-0f28-48b7-9475-3a32fbe5fe92 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OrderPosition that = (OrderPosition) o;
if (units != that.units) return false;
if (id != null ? !id.equals(that.id) : that.id != null) return f... |
a5ba7296-7e27-4ffa-8ef0-8509cf73a0a6 | 1 | public void actionPerformed(ActionEvent e)
{
// handles the add referee button being pressed
if (e.getSource() == addRefButton)
addReferee();
} |
5b07eb57-a4bc-4bd3-bf47-c75c32549475 | 7 | public Integer lowerNumberSeeker(int [] array){
if(array == null || array.length < 1){
return null;
}
Integer currentNumberOccurence = null;
Map<Integer, Integer> mappedNumbers = new HashMap<Integer, Integer>();
for (int i : array) {
currentNumberOccurence... |
3521f686-446f-411d-9c3b-a76a7ed03d1e | 4 | private Component generateMainPane() {
JPanel drawingCanvas = new JPanel() {
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
// setting to white because someone didn't supplied a picture
// with transparent background...
setBackground(Color.WHITE);
Display.this.... |
5626b9a5-d2b8-4aea-a55f-b9bb24296c75 | 8 | private int depthFirstSearch(Object object1, Object object2, int[] visited, byte count)
{
if (count > MAXDEPTH)
return 1000000;
int index1 = findIndex(object1);
int index2 = findIndex(object2);
int[] newVisited = new int[vis... |
13f2675b-3a82-4438-b1e8-8481137a1461 | 5 | public void backToMenu () {
/* uses if and else statements to check what the user would like to do */
int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?");
if (reply == JOptionPane.YES_OPTION) {
timer.stop();
reply = JOptionPane.showConfirmDialog(null, "Wou... |
35efceac-1eaf-420b-bb6e-1654453f9d2e | 5 | public JuvenileForm breed(int width, int height){
int size = getSize() * 2;
JuvenileForm juvenile = new JuvenileForm();
juvenile.setSize(size/2);
juvenile.setNutrientsLimit(getNutrientsLimit());
juvenile.setActionFrequency(getActionFrequency());
juvenile.setCostTimeToStoreNutrients(getCostTimeToStoreNutrien... |
6a5a2a5c-19ff-4caf-adce-6538ab15cac7 | 7 | private static int check_bbox_interest( Node root_node, NamedNodeMap item_attributes, Node id_node,
String passed_min_lat_string, String passed_min_lon_string, String passed_max_lat_string, String passed_max_lon_string )
{
boolean it_overlaps = true;
int return_value = 0;
Double p_min_lat_d;
Double p_min_l... |
b1fc6503-1e7a-4c10-83d9-fbd618191102 | 0 | public Integer getThreads() {
return threads;
} |
d3637d13-ec6b-417c-9bae-8c47866e860b | 0 | @Override
public void onAccount(IAccount account) throws JFException {
// // ストラテジーを停止した際に呼ばれます。
// LOGGER.info("onStop");
} |
a403df1f-3041-45ca-8052-87904bf08fb1 | 7 | protected void exportDone(JComponent source, Transferable data,
int action) {
dragStart = null;
if ( action == TransferHandler.MOVE ) {
Canvas canvas = (Canvas) source;
for ( Component comp : source.getComponents() ) {
if ( comp instanceof CanvasWidget ) {
CanvasWidget canvasWidget = (Canva... |
7c952635-812b-4392-a0c1-4b4bd670ec51 | 3 | public void move() {
for (Particle p : particles) {
if (p.active) {
p.x +=p.xV;
p.y +=p.yV;
p.life -= p.fade;
if (p.life <= 0.0) {
p.x = -20;
p.y = -20;
p.xV = 0;
p.yV = 0;
p.active = false;
}
}
}
} |
e347df22-7a26-42d9-94a3-47724fbe1535 | 3 | protected boolean isRicherFlavor(DataFlavor flavor)
{
DataFlavor[] richerFlavors = getRicherFlavors();
int nFlavors = (richerFlavors != null) ? richerFlavors.length : 0;
for (int i = 0; i < nFlavors; i++)
{
if (richerFlavors[i].equals(flavor))
{
return true;
}
}
return false;
} |
fd327f1f-5f11-4a24-ad6d-9ba4df912f93 | 9 | public int addLoad(int n, CtClass type) {
if (type.isPrimitive()) {
if (type == CtClass.booleanType || type == CtClass.charType
|| type == CtClass.byteType || type == CtClass.shortType
|| type == CtClass.intType)
addIload(n);
else if (type ... |
c626da0a-f4b1-488e-9d63-38722220565f | 9 | private int evaluateTest(String correct, String answer){
if (answer == null){
if (correct.compareTo("")==0 || correct ==null){
return CORRECT;
}
else{
return INCORRECT;
}
}
if (correct ==null || correct == ""){
return INCORRECT;
}
correct = correct.replace('“','"');
answer = an... |
a8d5524c-7af8-4868-b2f7-2b04c83ef72e | 3 | public static boolean writeObj(Serializable src, String absPath) {
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(absPath)));
oos.writeObject(src);
oos.flush();
return true;
}
catch (IOException e) { e.printStackTrace(); }
finally {
... |
fb013104-87bf-4e8e-bfda-4648c6cb93a2 | 3 | public static boolean isFreeFromBricks(int id, int x, int y) {
for (int i = 0; i < BrickGame.bricks.size(); i++) {
if (i != id) {
if (!BrickGame.bricks.get(i).is_free(x, y)) {
return false;
}
}
}
return true;
} |
3886a3bf-1dd5-4752-b57c-2dd3b73d119f | 7 | public boolean pickAndExecuteAnAction() {
try{
for(int i =0; i < Bills.size(); i++){
//print("" + Customers.get(i).s );
if(Bills.get(i).s == OrderState.needToCompute){
Compute(Bills.get(i));
return true;
}
}
for(int i =0; i < Bills.size(); i++){
if(Bills.get(i).s == OrderState.nee... |
3ddf5124-9816-4438-bc18-f65f60fd1385 | 1 | private BufferedImage loadImage(String ref) throws IOException {
URL url = TextureLoader.class.getClassLoader().getResource(ref);
if (url == null) {
throw new IOException("Cannot find: " + ref);
}
// due to an issue with ImageIO and mixed signed code
// we are now using good oldfashioned ImageIcon to loa... |
cff2f135-4a5c-41f6-9e91-c143c0343878 | 9 | Page readPageData(RandomAccessFile raf) throws IOException {
PageId pid;
Page newPage = null;
String pageClassName = raf.readUTF();
String idClassName = raf.readUTF();
try {
Class<?> idClass = Class.forName(idClassName);
Class<?> pageClass = Class.forNam... |
9aab12a3-98d6-4476-b64e-ddf55fa2fed1 | 2 | @Override
public String getResponse() throws IOException {
boolean reading = true;
StringBuilder response = new StringBuilder();
while(reading){// TODO test this
byte[] byteData = _responseUtilityHelper.getByteData(_connection.getInputStream());
String stringData = _responseUtilityHelper.getStringData(b... |
095b4f77-fea4-42f0-a358-4074fb430f8b | 1 | public GroupHelper getGroupHelper() {
if (groupHelper == null){
groupHelper = new GroupHelper();
}
return groupHelper;
} |
1ee997f1-1c2b-4652-8dbb-439b2c69e1da | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChannelTeds that = (ChannelTeds) o;
if (!dataConverter.equals(that.dataConverter)) return false;
if (!dataStructure.equals(that.dataStructure))... |
3fd7ea49-774d-4235-b0a7-20654a27c3d6 | 9 | public void leaveElement (String name) throws Exception {
// check for active custom parser
if (customParser != null) {
// delegate parsing to handler.
customParser.leaveElement (name);
// check if handler is done-
if (!customParser.isDone())
return;
// handle specific result.
if (customP... |
c4bb0787-4553-4b51-a824-362a57198868 | 2 | @SuppressWarnings("unchecked")
@Override
protected void process_hiccup (Object pipe_) {
// Destroy old outpipe. Note that the read end of the pipe was already
// migrated to this thread.
assert (outpipe != null);
outpipe.flush ();
while (outpipe.read () !=null) {
... |
3ef96661-5d9d-4208-8e12-848bbded9d88 | 7 | private void evaluateOpenMana() {
String openMana = this.gameState.openMana(this);
this.manaOpen = new int[6];
for (char ch : openMana.toCharArray()) {
switch (ch) {
case 'B':
this.manaOpen[0]++;
break;
case 'U':
this.manaOpen[1]++;
break;
case 'G':
this.manaOpen[2]++;
break;
... |
26582692-e296-45f4-b237-b6d627e60751 | 3 | private void timeMove(double voltage, double seconds) {
long milis = (long)(seconds * 1000);
long time = System.currentTimeMillis();
while (System.currentTimeMillis() < time + milis) {
drive.GoForward(voltage);
if (System.currentTimeMillis() - time > 10)
try {
Thread.sleep(10);... |
295f6812-c1a0-4b30-8d7c-9d4570621df7 | 4 | public static int stringWidth(String text) {
if (fontWidth.isEmpty()) {
return 0;
}
char[] chars = text.toCharArray();
int width = 0;
int spacepos = 0;
for (int i = 0; i < chars.length; i++) {
if (fontWidth.containsKey(String.valueOf(chars[i]))) {
... |
8e33e289-3ab0-4a58-9509-12f286f865e5 | 5 | public static int oppgave7()
{
int antallFeil = 0;
DobbeltLenketListe<Integer> liste = new DobbeltLenketListe<>();
for (int i = 1; i <= 7; i++)
{
liste.leggInn(i);
}
liste.nullstill();
if (liste.antall() != 0)
{
antallFeil++;
System.out.println
("Oppgave 7... |
6ccb1509-09e1-4e9c-95d9-2c89d148d51a | 3 | public boolean shipDestroyed(Ship ship)
{
for(int x = ship.x; x < ship.x+ship.xSize; x++)
for(int y = ship.y; y < ship.y+ship.ySize; y++)
if(sea[x][y] != HIT)
return false;
return true;
} |
6a8ec413-d3e3-43fa-9486-88ae98bd5d80 | 0 | public ROJoystickHandler getJoystickHandler() {
return joystickHandler;
} |
5bf6cb7d-b865-4583-8e96-9cd1024c3345 | 6 | final void method610(Class101 class101, int i, boolean bool) {
try {
anInt5550++;
if (aShortArray5608 != null) {
int[] is = new int[3];
for (int i_509_ = 0;
(anInt5557 ^ 0xffffffff) < (i_509_ ^ 0xffffffff);
i_509_++) {
if ((i & aShortArray5608[i_509_] ^ 0xffffffff) != -1) {
if (!bo... |
6f218c76-b62c-4edd-a630-188332edaaa9 | 4 | static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
... |
835dfeb0-9bd3-479d-9b19-37036bef38e4 | 6 | @Override
public void onUpdate(World apples) {
nightTime = apples.map!=0;
if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y)||life--<0)
{
alive = false;
}
if (next++%3==1)
{
radius+=1;
}
if (next%8==0)
{
... |
ace5765e-3e7f-4a50-8303-8d38236a130a | 4 | private boolean check2(int i, int j) {
int first = getMatrix(i, j);
if (first == 0 || first == -1) {
return false;
}
int second = getMatrix(i + 1, j);
int third = getMatrix(i + 2, j);
if (first == second && first == third) {
return true;
}
return false;
} |
e31e0525-c3ab-4b0f-8aaa-7c4a9f6fb4ac | 0 | @Override
protected void setColoredExes() {
// TODO Auto-generated method stub
coloredEx = LineGenerator.DDA(begin, end);
} |
98674e5a-d40f-43f5-9913-a9b337b27498 | 3 | public static List<String> listFilesForFolder(final File folder) {
List<String> files = new ArrayList<String>();
for (final File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
listFilesForFolder(fileEntry);
} else {
String fn = fileEntry.getName();
if (fn.substring(fn.length()-5,... |
4e5931cc-8324-4ffc-89b8-a1e5edbad422 | 6 | @Override
public boolean onMouseDown(int mX, int mY, int button) {
if(button == 0 && mX > x && mX < x + width && mY > y && mY < y + height) {
if(item != null) {
Application.get().getEventManager().queueEvent(new AttemptToBuyEvent(item));
Applicati... |
4c1a2e04-6bed-4de0-a6f5-ed67d6c39639 | 5 | public static Trajet creerTrajetConducteurConsole(Membre membreCourant){
System.out.println("Créatin d'un nouveau trajet en tant que conducteur.");
Scanner sc = new Scanner(System.in);
String villeDepart = Covoiturage.entreeNonVide("Ville de départ : ");
String villeArrivee = Covoiturage.entreeNonVide("Ville d... |
38b89fc4-db33-4bd6-b9b3-ee3a40fcb8f8 | 7 | public ArrayList<String> cmbEncarregadosPorDepartamento(String CodDepartamento) throws SQLException {
ArrayList<String> Encaregado = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDado... |
b1ba011c-457d-414e-ac96-0d6cb1fe8679 | 3 | public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage : Dissasembler <input file name> <output file name>");
System.out.println("Output is an html file");
System.exit(0);
}
else {
String inputFileName = args[0];
String outputFileName = args[1];
try {
FileW... |
7c70cc62-4355-4915-98fb-a23f769b0b2f | 6 | public String longestCommonPrefix(String[] strs) {
if (strs == null || strs.length == 0) {
return "";
}
int len = findShortestStr(strs);
String result = "";
boolean flag = true;
for (int i = 0; i < len; i++) {
char tmp = strs[0].charAt(i);
... |
eae74b97-a5de-4678-b442-68034c2cd943 | 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
... |
7afa345b-1201-4c7f-81ce-27217a065170 | 4 | public int count(int max) {
PrimeThread[] pts = new PrimeThread[4];
Thread[] ts = new Thread[4];
for (int i=0; i<4; i++) {
pts[i] = new PrimeThread(max, i);
ts[i] = new Thread(pts[i]);
ts[i].start();
}
for (int i=0; i<4; i++) {
try {
ts[i].join();
} catch (InterruptedException e) {... |
ac47753c-12bd-4a23-9cc6-9842447f22c2 | 6 | @Override
public void deleteDirectoryRecursively(String directory)
throws PathNotFoundException, AccessDeniedException {
try
{
attributeFs.deleteFile(getPermissionsPath(directory));
} catch (Exception ex)
{
}
try
{
attributeFs.deleteFile(getSymLinkPath(directory));
} catch (Exception ex)
{
... |
4da37f51-d1dd-4ba0-9aee-8fb435002abb | 0 | @Basic
@Column(name = "FUN_MM")
public BigInteger getFunMm() {
return funMm;
} |
e7d767b2-1ea9-436d-a009-24655372954f | 8 | public List<Triangle> get(Triangle triangle) {
List<Triangle> liste = new ArrayList<Triangle>();
if (triangle == null) {
return liste;
}
boolean aDifferentDeB = triangle.getA() != triangle.getB();
boolean bDifferentDeC = triangle.getB() != triangle.getC();
boolean aDifferentDeC = triangle.getA() != trian... |
c61fbf78-d717-4518-b18e-785cbbcdd0cb | 7 | private boolean HelpDelete(DInfo<T> op){
if(op==null || !(op instanceof DInfo))
return false;
boolean res = op.p.si.compareAndSet(op.si, new StateInfo<T>(StateInfo.MARKED,op), op.stamps.siStamp, ++op.stamps.siStamp);
StateInfo<T> app2 = op.p.si.getReference();
if(res || (app2.isMarked() && app2.info == op)){... |
3465f9d9-cd27-45f0-8a59-26dda65faf44 | 5 | public static <GItem, GItem2> Comparable<GItem> navigatedComparable(final Converter<? super GItem, ? extends GItem2> converter,
final Comparable<? super GItem2> comparable) throws NullPointerException {
if (converter == null) throw new NullPointerException("converter = null");
if (comparable == null) throw new Nu... |
ef7248d5-da1a-4a13-8635-b7392308c202 | 1 | public void clear() {
for ( int i = 0; i < size; i++ ) {
heap[i] = null;
}
size = 0;
} |
25daa7d1-dbdf-4eb6-8632-b6e996ed2282 | 4 | public boolean checkMuddles(String s) {
try {
muddleData.load(muddleFile);
for (String m : muddleData.getStringList("Muddles")) {
if (s.equalsIgnoreCase(m)) {
return true;
}
}
} catch (IOException e) {
e.... |
637dfd42-5322-4002-adac-627ffef17422 | 3 | public TheaterSeats requestTheaterSeats(int theaterID) throws RemoteException{
if(this.lastRequest == -1)
this.lastRequest = System.currentTimeMillis();
if(connectionTimout()){
System.out.println("Deu timeout");
return null;
}
TheaterSeatsReplyMessage reply;
reply = rmiServer.seatsRequest(thi... |
5ec4e963-3c39-4bcc-aab9-82c4befddb33 | 2 | @Override
public void registerComms(ICommsBus<?> bus) {
if (!wrapper.comms.contains(bus))
wrapper.comms.add(bus);
} |
587a4b2b-9bd2-41b5-8ac1-03e065fd3d14 | 3 | public static String executePost(String targetURL, String urlParameters){
HttpURLConnection connection = null;
try
{
URL url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty... |
58b78418-c786-452a-a1f2-7ca9f8f07f3f | 5 | public String nextCommand() {
command = scanner.next();
String[] words = command.split(" ");
for (int i = 0; i < words.length; i++) {
String temp = words[i];
if (listOfCommands.contains(words[i])) {
if (isDirection(temp)) {
// process d... |
e44efece-1e76-4ceb-8491-9441ee2d94b9 | 1 | public synchronized urlObj deQueueUrl() throws Exception {
if (mQueue != null) {
urlObj urlObj = mQueue.poll();
notifyAll();
return urlObj;
}else {
wait();
}
return null;
} |
65bb4589-291c-4a10-a297-6c6ca7aba422 | 3 | @Override
public void actionPerformed(ActionEvent event) {
if(event.getSource() == this.createBtn) {
if(!Utilities.isNullOrWhitespace(this.getValue())) {
this.create = true;
this.setVisible(false);
this.dispose();
} else {
JOptionPane.showMessageDialog(this, "Unable to create service without a ... |
ebbca62a-eb28-4751-a613-b58cdaaf33f9 | 9 | public boolean validadorDeCedula(String cedula)
{
boolean cedulaCorrecta = false;
try {
if (cedula.length() == 10) // ConstantesApp.LongitudCedula
{
int tercerDigito = Integer.parseInt(cedula.substring(2, 3));
if (tercerDigito < 6) {
// Coeficientes de vali... |
eb4c6067-e679-4f08-944f-6995d6cb41d2 | 9 | public void refreshActivators() {
if (activatorsFilename==null) return; // no file
Date nowDate = new Date();
long now = nowDate.getTime();
if (now < ( activatorsChecked + pollingFrequency ) ) return;
try {
File af = new File(activatorsFilename);
if (activatorsModifie... |
74d4f719-9eb0-46b7-bc68-ff79769cc4f5 | 7 | /* */ protected void loadJarURLs() throws Exception {
/* 164 */ this.state = 2;
/* 165 */ String str1 = "lwjgl.jar, jinput.jar, lwjgl_util.jar, " + this.mainGameUrl;
/* 166 */ str1 = trimExtensionByCapabilities(str1);
/* */
/* 168 */ StringTokenizer localStringTokenizer = new StringTokenizer(... |
a1664509-361b-4ea5-94b2-b1985daae07e | 2 | public static List readSourceFromFile(File file) {
List buffer = new ArrayList<String>();
String temp;
try(FileInputStream fInput = new FileInputStream(file);
InputStreamReader streamReader = new InputStreamReader(fInput);
BufferedReader reader = new BufferedReader(stre... |
60a79e08-bd81-4cc5-94f5-8276ac99e3b6 | 7 | public void performNextTurn() {
if (hasAWinner()) {
endGame();
return;
}
if (turnQueue.isEmpty()) {
refillTurnQueue();
}
onTurn = computeNextEntity();
if (onTurn != null && !onTurn.isOnTurn() &&
(entities.containsKey(onTurn) || npcs.containsKey(onTurn))) {
int token = generateTok... |
348156d1-2b54-4adc-827e-6f44ea1e1ef6 | 5 | protected void initialize() {
this.markerModels = new LinkedList<AbstractMarkerModel>();
List<PictureObject> pictures = this.files.getPictureList(); //fetch pictures
List<LocationObject> locations = new LinkedList<LocationObject>();
int nbrOfPictures = pictures.size();
int index;
for (index = 0; index < n... |
f88feaf9-c513-4d9e-ba36-dddccf96fc97 | 2 | public Tile getFirstTile() {
Tile ret = null;
int i = 0;
while (ret == null && i <= getMaxTileId()) {
ret = getTile(i);
i++;
}
return ret;
} |
38667f9c-3e4b-4f4b-80ca-f4d17c4fcd97 | 1 | public boolean matches( Class<?> clazz )
{
return this.targetPackage.equals( clazz.getPackage().getName() );
} |
dfe8ac1d-346b-4e27-a2b6-e3a18e63bb29 | 3 | @Override
public void valueChanged(ListSelectionEvent event) {
if (!event.getValueIsAdjusting()) {
ListSelectionModel lsm = (ListSelectionModel) event.getSource();
if (lsm.isSelectionEmpty() == false) {
try {
int selectedRow = lsm.getMinSelectionIndex();
// da in der Tabelle die Autosortierung ... |
6063b26c-7bdb-40b2-a70f-b2d555a1996e | 5 | @Override
public boolean equals(Object object) {
if (!(object instanceof User)) {
return false;
}
User other = (User) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
... |
965625cd-b3c7-4e2b-afe8-bf8c817a5947 | 4 | public static int maxPathSum(TreeNode root) {
if(root == null) return 0;
if(root.left == null && root.right == null) return root.val;
//helper[0] min, helper[1] leftMax, helper[2] rightMax
int[] helper = new int[3];
int max = 0;
helper[0] = Integer.MIN_VALUE;
... |
bad8d62b-8f58-423e-a5fc-c96af6697e3c | 5 | private static void ExecuteCommand(String CommandText, File WorkingDirectory) {
final Process p; // Process tracks one external native process
BufferedReader pis; // reader for output of process
String pline = "";
try {
p = Runtime.getRuntime().exec(CommandText, null,... |
1e852f98-9c99-4873-b05d-b2dce362b9e9 | 9 | public static int scan(File path)
{
long ct = 0;
int count = 0;
obj = new Object[1000][2];
RandomAccessFile br = null;
try
{
int ctl = 0;
File f = path;
br = new RandomAccessFile(f, "r");
FileChannel inChannel = br.g... |
e68f50a3-217b-48b0-9a6b-1370053b321b | 7 | public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err.println("This application requires two arguments: <machine> <port>");
return;
}
String host = args[0];
int port = 0;
try {
port = Integer.parseInt(args[1]);
} catch (NumberFormatException nfe) {
... |
214c3c2e-1041-4f3d-8294-3d9c796f5105 | 6 | public void draw(Graphics g) {
//Graphics2D g2 = (Graphics2D)g;
//g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(needsHighlight() ? selectColor : lightGrayColor);
Font f = new Font("SansSerif", 0, size);
g.setFont(f)... |
528bf12a-61fd-4259-8020-9e6e1e2b3ed5 | 6 | private void addRoomsToFrameInGrid(ArrayList<Room> rooms, JPanel panel){
panel.removeAll();
if (!rooms.isEmpty()){
Location first = rooms.get(0).getLocation();
int minX, maxX;
minX = maxX = first.getX();
int minY, maxY;
minY = maxY = first.getY();
for (Room r: rooms){
int curX = r.getLoca... |
309852ae-bcb2-45fc-8aa2-da5b90b8a5ee | 7 | public void updateTimer() {
long i = GameApplication.getTime();
long j = i - this.lastSyncSysClock;
long k = System.nanoTime() / 1000000L;
double d0 = (double) k / 1000.0D;
if (j <= 1000L && j >= 0L) {
this.field_74285_i += j;
if (this.field_74285_i > 10... |
89224a04-0a9f-4327-a28f-6b169c0da90a | 8 | public void right()
{
//System.out.println("right");
switch(aniCount)
{
case 1:
sprtPlyr = imgPlyrR1.getImage();
if(Game.tickCount2 == Game.DELAY){
aniCount = 2;
}
break;
case 2:
sprtPlyr = imgPlyrR2.getImage();
if(Game.tickCount2 == Game.DELAY){
aniCount = 3;
}
b... |
08e6f5df-be28-434a-bcca-dc084a6d4ecc | 4 | private String prepareFile(JoeTree tree, DocumentInfo docInfo, String lineEnding, String template) {
// Figure out max_style_depth
int max_style_depth = 0;
String match = "{!max_style_depth:";
int start = template.indexOf(match);
if (start != -1) {
start += match.length();
int end = template.indexOf(... |
030d31ab-711a-4cb8-81a6-29ec048a610a | 5 | private static void lisaaPuolisoja(int puolisoja, ArrayList<Sitsaaja> sitsaajat) {
int i = 0;
do {
Sitsaaja sitsaaja = Yhteydet.annaRandomSitsaaja(sitsaajat);
do {
sitsaaja = Yhteydet.annaRandomSitsaaja(sitsaajat);
} while (sitsaaja.puolisoIsSet() == t... |
d075c342-4a04-4de0-9127-2a132850a013 | 5 | private static Move BackwardLeftCaptureForWhite(int r, int c, Board board)
{
Move backwardLeftCapture = null;
if(r>=2 && c>=2 && (
board.cell[r-1][c-1].equals(CellEntry.black)
|| board.cell[r-1][c-1].equals(CellEntry.blackKing)
)
... |
ca5142e5-de5d-4f8e-87b0-fffe2dc4be5e | 8 | Color getShadedColorForType(int pType, double pSunValue)
{
double lBrightness;
if(pSunValue < 0)
{
// The sun is below the horizon.
lBrightness = fNightSideBrightness / 100;
} else
{
// The sun is above the horizon. The brightness will range from
// the base to the maximum... |
f0f6dd77-cd97-4a55-a01b-cea056cab5e1 | 8 | void writeUTF(String str, int off, int len) throws IOException
{
// compute utf length
int utflen = 0;
for (int i = 0; i < len; i++)
{
int ch = str.charAt(off + i);
if ((ch >= 0x0001) && (ch <= 0x007F))
{
utflen += 1;
}
... |
ae800256-64b7-434e-bf0a-877991f819b4 | 4 | public void paintTileLayer(Graphics2D g, TileLayer layer) {
final Rectangle clip = g.getClipBounds();
final int tileWidth = map.getTileWidth();
final int tileHeight = map.getTileHeight();
final Rectangle bounds = layer.getBounds();
g.translate(bounds.x * tileWidth, bounds.y * ti... |
a29a2af3-97b6-4165-9b38-062a21a50e76 | 7 | @Override
public LQ factor(DenseMatrix A) {
if (Q.numRows() != A.numRows())
throw new IllegalArgumentException("Q.numRows() != A.numRows()");
else if (Q.numColumns() != A.numColumns())
throw new IllegalArgumentException(
"Q.numColumns() != A.numColumns()"... |
b055a498-f2a0-4359-8e6e-d23cc9be03c3 | 1 | private void statementList()
{
while (have(NonTerminal.STATEMENT))
{
statement();
}
} |
3a61ec19-a54e-43d6-8187-417dbf2713e1 | 4 | @Override
public void run(){
@SuppressWarnings("resource")
final Scanner input = new Scanner(System.in);
System.out.println("Please enter a site to show the HTML tree, or type in \"exit\" to exit!");
while(true){
System.out.print(">> ");
String site = input.next();
if (site.equalsIgnoreCase("exit")... |
1115c264-09ad-4f53-816c-6a1253055174 | 3 | @Transactionnal
User txFindUser(String email) throws DuplicateUserEmailDetected {
// Using named queries.
// Eventually look into adding them in mapping document to avoid overloading the entity class with annotations...
// My goal with named queries is to get compile-time checks vs potential runtimes after ent... |
3a2d5301-3047-41bd-b134-d8500158a7f4 | 4 | private void pausePad() {
final Map<Integer, Double> noteDuration = new HashMap<>();
double max = 0;
for (final Entry<Integer, AbcTrack> trackEntry : tracks.entrySet()) {
final AbcTrack track = trackEntry.getValue();
final Integer id = trackEntry.getKey();
final Double duration = track.getNoteDuration();... |
6d1acce2-fb7b-4bbb-a966-19310dfcb2e4 | 6 | protected void updateBounds() {
final Descent update = new Descent() {
public boolean descendTo(Section s) {
//
// If the section has already been updated, or isn't a leaf node,
// return.
if (! s.updateBounds) return false ;
if (s.depth > 0) return true ;
//
... |
240c58a0-ffff-4858-a63e-fc181fac321b | 2 | public void commitGroops()
{
Iterator<String> kIt = tempStore.keySet().iterator();
while (kIt.hasNext())
{
// Get the groop name
String groopName = kIt.next();
Groop grp = tempStore.get(groopName);
// Get the full groop
if (!groops.keySet().contains(gro... |
a8b05d2a-3b53-4b26-b17d-06748e8bddce | 8 | boolean shootDroid(JSONObject action, int turnsLeft){
int droidLevel = 1; // TODO
if(primaryWeapon.equals("droid")){
droidLevel = primaryWeaponLevel;
}
else if(secondaryWeapon.equals("droid")){
droidLevel = secondaryWeaponLevel;
}
else {
Debug.warn("User '" + username
+ "' attempted to sh... |
0201e38e-348c-4143-9dc8-f70f142c6d95 | 1 | public static void main(String[] args) throws IOException {
ChatWindow window = new ChatWindow();
window.setVisible(true);
ServerSocket serverSocket = new ServerSocket(9097);
List<Socket> sockets = new ArrayList<Socket>();
BlockingQueue<String> messages = new LinkedBlockingQueue<String>();
// LinkedBlockin... |
52a6b837-a4b5-44b5-9cf8-79e0dd31829e | 0 | public static void main(String[] args) {
w = new Worker();
} |
6a97b738-3789-4569-a6d0-45d4c177af41 | 1 | public static boolean getKeyDown( int keyCode )
{
return getKey( keyCode ) && !lastKeys[keyCode];
} |
b7af79c3-e222-4a31-90cb-bae963e7c793 | 1 | @Override
public void fireEvent(UIEvent e) {
super.fireEvent(e);
if(e instanceof StateChangeEvent) {
processStateChangeEvent(e);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.