method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c59865fc-3e67-4566-b7e5-32e6a1b77301 | 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... |
6a2cc66f-3371-4d84-80de-097d8dfbc523 | 2 | public void flatten(TreeNode root) {
if(root == null)
return;
TreeNode left = root.left;
TreeNode right = root.right;
previous = root;
flatten(left);
if(previous != root){
previous.right = right;
root.right = l... |
aa3cee9a-13a7-473e-a13a-01c442882c7b | 4 | public int getPointCur() {
if (milestone.equalsIgnoreCase("alterations")) {
if (pointCur == 0)
return 0;
else if (pointCur < 3)
return -10;
else if (pointCur < 6)
return -15;
else
return -25;
}
return pointCur;
} |
721df5df-2a86-44d9-8b2e-2cb4032f1248 | 1 | public int exprHashCode() {
return 13 + (fromStack ? 0 : 1) + index + type.simple().hashCode();
} |
c20e282a-201a-4a0e-81c9-6e87fb8a0fa0 | 2 | private void createBooks(Scanner s, ArrayList<Book> books, ArrayList<String> booksText) { // method to read Books.txt file and create user Objects
while (s.hasNextLine()) {
booksText.add(s.nextLine()); // fill string arraylist with lines from Books.txt
}
for (int i = 0; i < booksText.size(); i++) { // read eac... |
56252a8b-0cbf-4ed6-b047-017e51e01ad4 | 3 | public void drawImg(ArrayList<Layer> layers) throws IOException {
int width = layers.get(0).colorArr[0].length;
int height = layers.get(0).colorArr.length;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics g = image.createGraphics();
f... |
690630fd-50ca-4958-bdb4-0a387cd592db | 0 | public int getMaxValueLength(){
return maxValueLength;
} |
3b2b03ee-4d51-4dc5-9be8-7dea968cfc46 | 4 | public void valueChanged( TreeSelectionEvent e )
{
TreePath path = warnings.getSelectionPath() ;
if (path != null)
{
Object source = path.getLastPathComponent() ;
if ( source != null )
{
if ( source instanceof TValueNode )
{
TValueNode vDummy = ( TValueNode ) so... |
d7eb129b-842e-448e-a6af-c1306c1699a5 | 1 | public String getMFENumberVersion() {
if (mfeNumberVersion == null) {
return "1.0.0";
} else {
return mfeNumberVersion;
}
} |
3ed59469-5208-4286-a20f-12cd6caf8b8c | 4 | private void init() throws Exception
{
// If this resource doesn't have any PEs then no useful at all
if (resource_.getNumPE() == 0)
{
throw new Exception(super.get_name() + " : Error - this entity " +
"has no PEs. Therefore, can't process any Gridlets.");
... |
cf31060f-ac52-49e9-a34b-e9d37bff6a25 | 8 | public static void destroyDirectBuffer(Buffer toBeDestroyed) {
if (!isDirect(toBeDestroyed)) {
return;
}
BufferUtils.loadCleanerMethods();
try {
if (freeMethod != null) {
freeMethod.invoke(toBeDestroyed);
} else {
Obje... |
db91790b-b6a4-4683-8b21-42c18f86331a | 7 | public void get(Powerup pu, Game game) {
if(pu.type == 0) {
level++;
if(level >= weapons[type].length) { level--; }
pu.die();
}
else if(pu.type == 1) {
level=0;
type++;
if(type >= 3) { type = 0; }
//if(level >= weapons[type].length) { level--; }
pu.die();
... |
b075c6e2-4975-449e-afd6-66fae3cd8b50 | 7 | private static boolean test4_3() throws FileNotFoundException {
String input = "new\n" + "drop key\n" + "drop rock\n" + "quit\n"
+ "yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(input.getBytes());
System.setIn(in... |
382e51dd-7d21-4a39-8b9f-6f6f7f781a30 | 6 | private void Declare() {
String name;
String type;
if(current.getId().substring(0,4).equals("TYPE")) {
type = current.getId();
nextToken();
if(current.getId().equals("VARNAME")) {
name = current.getLexeme();
nextToken();
if(current.getId().equals("ASSIGN")) {
Values.createVariable(type,n... |
7fed1a73-4ed9-458e-8d8f-b273f3316cb9 | 2 | @Override
public String getDefaultExtension() {
Iterator i = getExtensions();
while (i.hasNext()) {
String key = (String) i.next();
Boolean value = (Boolean) extensions.get(key);
if (value.booleanValue()) {
return key;
}
}
return null;
} |
1876705b-5b44-40af-a7d5-86375a80492f | 8 | public boolean executeLine(String line) {
if (system == null && line.startsWith("xearth")) {
extractDimension(line);
system = new PSystemXearth(width, height, config, markers);
return true;
}
if (system == null) {
return false;
}
if (line.startsWith("#") || line.startsWith("'")) {
return true;
... |
a3d9f221-9652-45a1-a9a7-60fe2fd71576 | 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... |
769e8163-3ed7-4c58-8103-07e96d1554e9 | 3 | private JTabbedPane getFP() {
JTabbedPane tabbedPhases = new JTabbedPane();
for (int i = 0; i < xs.length; i++) {
for (int j = i + 1; j < xs.length; j++) {
String name = "x" + (j + 1) + "-x" + (i + 1);
FigurePanel phase = new FigurePanel(getName() + " " + name, "x"
+ (j + 1), "x" + (i + 1));
ph... |
d2b79b2d-7da9-496c-b593-6dc675430f9c | 2 | public static void main(String args[]){
try{
ServerSocket ssocket = new ServerSocket(8888);
System.out.println("Server waiting!");
int clientcnt = 1; String name = "";
head = null;
while(true){
Socket socket = ssocket.accept();
System.out.println("A client has joined the rumble!");
MyConnec... |
935018af-02a9-470e-a161-9b99f45ec80c | 9 | public String tail(int lines) throws IOException {
java.io.RandomAccessFile fileHandler = null;
try {
fileHandler =
new java.io.RandomAccessFile( logFile, "r" );
long fileLength = logFile.length() - 1;
StringBuilder sb = new StringBuilder();
int line = 0;
... |
55857d0d-f4f7-4437-a948-b98dbc6c7fbd | 1 | public <E> boolean validateSignature(Passable<E> sig, PublicKey pKey)
throws NoSuchAlgorithmException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
try {
out = new ObjectOutputStream(bos);
out.writeObject(sig.data);
bos.close();
out.close();
} catch (IOExce... |
c2053013-0a17-42bf-990a-af8e4e325f82 | 3 | public boolean checkLimits(int x, int y, BoardModel boardModel) {
return (x >= 0 && x < boardModel.getBoardWidth() && y >= 0 && y < boardModel.getBoardHeight());
} |
d301a9b3-dd1c-4732-a677-86213a45029c | 6 | final int getCurrentPercent() {
anInt3909++;
if (loadingStage == null)
return 0;
int stage = loadingStage.getStageId();
if (((LoadingStage) loadingStage).aBoolean1016 && (((LoadingStage) loadingStage).finalPercent > currentPercent))
return 1 + currentPercent;
if (stage < 0 || Class328_Sub2.loadingStages.... |
c1bd1a71-0ace-4d73-83c3-e9ce22766e41 | 7 | private void initCloseCode() throws InvalidFrameException {
code = CloseFrame.NOCODE;
ByteBuffer payload = super.getPayloadData();
payload.mark();
if( payload.remaining() >= 2 ) {
ByteBuffer bb = ByteBuffer.allocate( 4 );
bb.position( 2 );
bb.putShort( payload.getShort() );
bb.position( 0 );
code... |
417021e9-016f-4221-a020-d4dd51071502 | 7 | void radf4(int ido, int l1, final double cc[], double ch[],
final double wtable[], int offset)
{
final double hsqt2=0.7071067811865475D;
int i, k, ic;
double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
int iw1, iw2, iw3;
... |
f6683642-e661-45ed-bfe1-1452d478585e | 1 | public void buildMenu() {
logger.info("Building plugin menu");
menu.removeAll();
for (String name : constructors.keySet()) {
JMenuItem mi = new JMenuItem(name);
// ActionCommand contains the name of the plugin = key in the map
mi.setActionCommand(name);
mi.addActionListener(listener)... |
173357cb-684f-4e40-bb8e-8ce1f48ef4ae | 1 | public void animate() {
for(int x = 0; x<mapTiles.size(); x++) {
mapTiles.get(x).animate();
}
} |
5fa994e5-f3e7-40c6-9a74-06a247f579d7 | 9 | private boolean r_mark_suffix_with_optional_y_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 153
// or, line 155
lab0: do {
... |
4c295c01-ed07-40f0-b393-f008db6de282 | 4 | private boolean read() {
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", "U... |
e41b3cc3-9391-4d06-8980-4183fee37cb9 | 0 | public float getDiscount(int index){
return discount[index];
} |
1b123f21-869b-4962-9347-32122a65c8ed | 4 | @Override
public void run() {
//Attendre 1.5 seconde avant de faire exploser la bombe
try {
sleep((long) 1500);
}
catch(InterruptedException e) {}
state = true;
//Afficher l'animation d'explosion avec 0.05s entre chaque image
... |
c95224ce-3790-47e2-b3a4-66d3c140d664 | 8 | public void checkDoors(){
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
if(getTile(x, y).equals(Tile.doorTileTD)) if(!getTile(x - 1, y).equals(Tile.wallTile) || !getTile(x + 1, y).equals(Tile.wallTile)) setTile(x, y, 1);
if(getTile(x, y).equals(Tile.doorTileLR)) if(!getTile(x, y - 1).equ... |
b3a95d5e-a999-450e-ae59-0cc3703d58d4 | 1 | public Object nextElement() {
if (nextElement == null)
throw new NoSuchElementException();
Object answer = nextElement;
// Stay one ahead to facilitate the determination of hasMoreElements.
getNextElement();
return answer;
} |
098ca268-b981-416d-af69-7ee1a71132f1 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmailAddress that = (EmailAddress) o;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (label != null ? !label.equals(t... |
4b9823d6-9cec-4ab4-8167-c7b4f55fccea | 5 | public EditorPanel(EditorMain parent) {
addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e) {
offy += e.getWheelRotation() * GRID_SIZE * 2;
repaint();
}
});
myparent = parent;
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked... |
9156e0c0-ba8c-4532-9376-63b3d873a02b | 7 | public void getTotalAtendimentosByStatus() {
Thread acao;
acao = new Thread(new Runnable() {
@Override
public void run() {
while (getTitle() != "") {
lb_qtdeAbertos.setText("0");
lb_qtdeExecutando.setText("0");
... |
f7f03cb7-dff6-4c33-af78-137cb2dda65f | 7 | public void shuffle(Align algorithm, String sq1, String sq2, final int numShuffles) {
if (monitor != null) {
monitor.setMinimum(0);
monitor.setMaximum(numShuffles);
}
float[] scores = new float[numShuffles];
float sumScores = 0;
for(int i = 0; i < numShu... |
b9c97c18-0eec-4ddf-9b41-ff902968cd3c | 1 | @Override
public void move() {
Box newBounds = desiredLocation();
if (world.contains(newBounds)){
super.move();
}
} |
4d283765-2880-4583-afd1-998d8c7e1f19 | 7 | public void loadBoardConfig() {
try {
FileReader reader = new FileReader(layoutFile);
Scanner scan = new Scanner(reader);
String str;
String[] letters;
numColumns = 0;
numRows = 0;
for(int i=0; scan.hasNextLine(); i++, numRows++) {
str = scan.nextLine();
letters = str.split(",");
if (... |
0f42382c-1e37-4fea-8f3b-24b735f0e849 | 7 | public byte[] HandleRevealationMessage(RevealationMessageEventObject result)
{
//RevealationMessage message = new RevealationMessage(ByteBuffer.wrap(data));
switch(result.get_revealMessage()._revealationApi)
{
case (byte) 0xE3:
// ECM/Appliance Info
return HandleDeviceInformation(result.get_revealMes... |
bf5808a9-6576-4556-abfb-048a71669e45 | 3 | public void unClick(Button b)
{
for(int i=0; i<buttons.size(); i++)
{
if(buttons.get(i).isSticky() && buttons.get(i)!=b)
{
buttons.get(i).deselect();
}
}
} |
e3896a14-94e7-4073-8751-06521209ecdc | 4 | public void waitForConsumers() {
Object[] threads;
synchronized(consumers) {
threads = new ArrayList(consumers.keySet()).toArray();
}
for(int i = 0; i < threads.length; i++) {
Thread thread = (Thread)threads[i];
if(thread != null && thread.isAlive()) {
try {
thread.join();
}
catch(Inte... |
be7477f5-8643-4097-bf0f-3cd2917e4262 | 6 | @EventHandler
public void WitchHeal(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Heal.DodgeCha... |
0cf8b16f-4122-4422-92d3-f4e172c959b8 | 0 | public Boolean getPlayerWin() {
return playerWin;
} |
28e40989-bbf7-448a-ac03-5a040744df69 | 6 | private static boolean implementsLogFactory(Class logFactoryClass) {
boolean implementsLogFactory = false;
if (logFactoryClass != null) {
try {
ClassLoader logFactoryClassLoader = logFactoryClass.getClassLoader();
if (logFactoryClassLoader == null) {
... |
affef124-eff9-4bc2-8c0d-306cd2445ae8 | 8 | public void buildClassifier(Instances instances) throws Exception {
getCapabilities().testWithFail(instances);
// copy the dataset
m_train = new Instances(instances);
// new dataset in which examples with missing class value are removed
m_train.deleteWithMissingClass();
// build the Map for... |
071be046-b063-4f30-84e2-5c13f8b7b563 | 7 | public Node findLCA(Node root, Node element1, Node element2) {
if (root != null) {
boolean isContains = (isContains(root.left, element1) && isContains(root.right, element2)) || (isContains(root.left, element2) && isContains(root.right, element1));
if (isContains)
return ... |
2a0f13e4-42ad-4d3d-868f-01108331e9b8 | 7 | public final boolean runLookAhead() throws FatalError, RestartLater {
int toRun;
if (lookAheadPlan == -1) {
// ersten LookAhead
toRun = getNextPlan(runningPlan);
} else {
// es war schon mindestens ein LookAhead
toRun = getNextPlan(lookAheadPlan);
}
if (toRun == -1) {
return false;
... |
d87d9604-19e9-4f9e-a3e4-62de63c9de24 | 0 | private static void findAction(String action) {
} |
155030f7-0f4e-4406-bf6b-6e1d0f071bd4 | 3 | public static void printAll()
{
try
{
PreparedStatement stmt = Main.EMART_CONNECTION.prepareStatement("select * " +
"from ShippingNotice");
ResultSet rs = stmt.executeQuery();
System.out.println("Shippin' Notice:");
while (rs.next())
{
System.out.println(rs.getInt("ship_id") + "|" + rs.getS... |
ee03dfab-6131-4889-8857-d3d2008656a8 | 9 | private int buildJump(int xo, int maxLength)
{
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nextInt(3) == 0;
int floor = height - 1 - random.nextInt(4);
for (int x = xo; x < xo + length; x++)
... |
0a8eea82-0386-4bd5-9591-d2875220b1a3 | 7 | public int minStrokes(String stripe) {
int[][] dp = new int[stripe.length()][stripe.length()];
for (int x = 0; x < stripe.length(); x++)
dp[x][x] = 1;
for (int size = 1; size < stripe.length(); size++) {
for (int from = 0; from < stripe.length(); from++) {
int to = from + size;
if (to >= stripe.len... |
d78b5266-8b44-4e4a-85ed-984ad416e13c | 9 | public static void main(String [] args) {
try {
PairedStats ps = new PairedStats(0.05);
java.io.LineNumberReader r = new java.io.LineNumberReader(
new java.io.InputStreamReader(System.in));
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
if (l... |
11d2bf73-00f6-4ac8-a0b4-cd868fdcc445 | 4 | @Override
public void createPlayerAccount(String player_name) {
PreparedStatement pst = null;
int player_id = getPlayerId(player_name);
if (player_id == 0) {
try {
pst = conn.prepareStatement("INSERT INTO ffa_leaderboards(player_name) VALUES (?)");
pst.setString(1, player_name);
pst.executeUpdate(... |
faa1ad47-5f9c-429d-82d1-11300724ece5 | 3 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
reply("Environments provided by Bukkit:");
for (Environment thisEnv : World.Environment.values()) {
sender.sendMessage(thisEnv.toString());
}
reply("Environments provided by XcraftGate:")... |
e58b5fff-1a35-4d86-ad8f-527446e55816 | 9 | public static GetFields_Result getFields(Database database, GetFields_Param params) throws APIException {
Logger.getLogger(API.class.getName()).log(Level.FINE, "Entering API.getFields()");
GetFields_Result result;
try { // Validate User
ValidateUser_Result vResult = validate... |
aab5c204-f689-4929-a35e-04af6309d20e | 6 | @Override
public void manageInput(InputEvent e) {
if (e.isMouseInput()) {
Vector v = e.getVector();
if (e.getType() == InputEvent.MOUSE_PRESSED) {
if (isWithinDims(v))
isPressed = true;
}
if (e.getType() == InputEvent.MOUSE_RELEASED) {
if (isPressed && (isWithinDims(v)))
notif... |
2f47596a-c0e7-4778-80af-4ca26ed575b4 | 1 | void move(int delta) {
try {
DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
Date d = df.parse(currentDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(d);
calendar.add(Calendar.DATE, delta);
DateFormat df2 = new Simp... |
8fd608db-f233-4033-9301-5404bd98f9be | 9 | public boolean iterate() {
for(i=0;i<w;i++) for(j=0;j<h;j++) cells[i][j].setDestiny();
boolean temp = true;
for(i=0;i<w;i++) for(j=0;j<h;j++) if(cells[i][j].getDestiny() != cells[i][j].getStatus()) temp = false;
if(temp || this.checkForCycles()) return true;
for(i=0;i<w;... |
80db443a-ad40-4fbf-a4a3-d07bdd9a7f43 | 2 | protected void signIn(String userName, String password) {
if (productSvc == null) {
productSvc = GWT.create(ProductService.class);
}
AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(Boolean valid) {
if(valid)
... |
503d4953-74fd-4c6d-bc74-af9a8d8a37e4 | 9 | public void mouseClicked(MouseEvent e) {
int i=0, j=0, found=0;
int xpos=extpad, ypos=extpad;
for(j=m_selectedAttribs.length-1; j>=0; j--) {
for(i=0; i<m_selectedAttribs.length; i++) {
if(e.getX()>=xpos && e.getX()<=xpos+cellSize+extpad)
if(e.getY()>=ypos && e.getY()<=ypos+cellSize+extpad... |
7f471d84-6ecd-4f47-973d-6bd9529d892b | 5 | public void controlEvent(ControlEvent theEvent) {
if (theEvent.isGroup()) {
// an event from a group e.g. scrollList
// println(theEvent.group().value()+" from "+theEvent.group());
if (theEvent.isGroup() && theEvent.getName().equals("StationDepart")) {
AreaDepart = new ControlP5(this);... |
9dc82236-9d92-4302-be91-7b158eb55b88 | 6 | private HyperlinkListener getLinkListener() {
return new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) {
((HTMLDocument)html.getDocument()).processHTMLFrameHyperlinkEven... |
12b97450-920b-4b71-9668-dd6a23e85e74 | 2 | public Person getChild(int i) {
if (i < 1 || i > children.size())
return null;
else return children.get(i-1);
} |
47f7bc6a-3c55-45b2-90f7-b3e6b5bd6bf2 | 7 | public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
if (nums == null || nums.length == 0 || t < 0 || k < 1) {
return false;
}
SortedSet<Long> set = new TreeSet<Long>();
for (int i = 0; i < nums.length; i++) {
int n = nums[i];
SortedSet<Long> subSet = set.subSet((long) n - t, (long)... |
89fbab62-caf6-44d2-b2ed-d05c975e6a82 | 8 | public void buildClassifier(Instances insts) throws Exception {
m_NominalToBinary = null;
m_Filter = null;
if (!isPresent())
throw new Exception("liblinear classes not in CLASSPATH!");
// remove instances with missing class
insts = new Instances(insts);
insts.deleteWithMissingClass()... |
319064a3-5716-4e33-a361-c52c48f54e9b | 8 | public static String toLowerCamel(String name) {
StringBuilder sb = new StringBuilder(name.length());
boolean toUpperCase = false;
for (int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
if (c == ' ' || c == '_' || c == '-') {
toUpperCase = true;
} else if (toUpperCase) {
sb.append(Cha... |
30a0c90d-824d-432d-bf27-e2cc38e37658 | 2 | public Menu(final Game game)
{
this.game = game;
// create font
PFont font = game.loadFont("fonts/Calibri-20.vlw");
game.textFont(font, this.c_fontSize);
int line = 130;
// add menu items
this.itemList.add(new MenuItem(830, line, 140, 30)
{
@Override
public String getText()
{
return "Ho... |
e17c1b59-9007-4088-bc82-c849cf4b0e01 | 9 | public boolean birthChecker() {
switch (state) {
case NONE:
// If leftHand is below leftElbow which is below leftShoulder (or right)
if (GestureInfo.gesturePieces[GestureInfo.LEFT_HAND_DOWN]
&& GestureInfo.gesturePieces[GestureInfo.RIGHT_HAND_D... |
da08df40-869c-448d-abe9-93e1df2b0caf | 7 | public void run() {
final String methodName = "run";
MqttToken token = null;
while (running && (in != null)) {
try {
//@TRACE 852=network read message
log.fine(className,methodName,"852");
MqttWireMessage message = in.readMqttWireMessage();
if (message instanceof MqttAck) {
token =... |
2a660f8e-81c1-4bd1-9df7-d75f1663f03a | 3 | private boolean jj_3R_51() {
if (jj_scan_token(ELIF)) return true;
if (jj_3R_50()) return true;
if (jj_scan_token(THEN)) return true;
return false;
} |
55a7754f-8675-4625-ac10-76ea1a142420 | 9 | private void loadCurConf()
{
int iCnt = 0, iLen = 0;
// C U R R E N T S E T T I N G S ---------------------------------
// multicast group IP
this.jtfdMcGroup.setText(EzimConf.NET_MC_GROUP);
// multicast group port
this.jspnMcPort.setValue(EzimConf.NET_MC_PORT);
// direct transmission port
this.js... |
7e10b509-1d67-414e-8cf6-2a88a478133b | 2 | public Benutzer getBenutzervonBenutzername(String Benutzername) {
Benutzer rueckgabe = null;
try {
ResultSet resultSet;
resultSet = db
.executeQueryStatement("SELECT * FROM Benutzer WHERE Benutzername = '"
+ Benutzername + "'");
if(resultSet.next())
rueckgabe = new Benutzer(resultSet, db, th... |
f3a7930a-215b-44c5-95d9-a9ee7482121a | 1 | public static boolean isUnsafe(JComponent c) {
Boolean b = (Boolean) c.getClientProperty(PROPERTY_UNSAFE);
if (b == null) {
b = Boolean.FALSE;
}
return b.booleanValue();
} |
59284cfb-5783-43b1-8f9b-95e38558140d | 6 | @Override
public Company find(long id) {
String query = "SELECT * FROM company WHERE id="+id;
ResultSet results = null;
Connection connect = ConnectionMySql.getInstance();
Company company = null;
try (Statement stmt = connect.createStatement()){
results = stmt.executeQuery(query);
company = n... |
ae91f3b7-17e7-4752-80a6-b8967b9a2385 | 4 | synchronized void setThumbImage(BufferedImage img,ImageType type){
MultiSizeImage setter;
if(type==ImageType.Icon) setter=iconImage;
else setter=originalImage;
if((img!=null)) setter.thumbDimensions=new Dimension(img.getWidth(),img.getHeight());
//if(img==null) {Log.Print(LogType... |
90074a77-18d2-4a25-966e-cb807e6f32dd | 2 | public static void memorizeObject(Object ob, String obFileName) {
System.out.println("memorizing object ... ");
File nextFile = new File(obFileName);
try {
nextFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
FileOutputStream fileout... |
964be79b-a245-46ee-9c20-3e62849c8bba | 3 | public static int fib(int n){
if(n==0) return 0;
if(n==1 || n==2) return 1;
int[][] f = {{1,1},{1,0}};
powMatrix(f, n-1);
return f[0][0];
} |
4b0cc30b-a93a-4f2f-848f-2f18be385866 | 8 | public void breadthFirst(int bfi) {
for(int i=0; i<500; i=i+20) {
for(int j=0; j<500; j=j+20) {
if(grid[i/20][j/20].path_no == bfi) {
for(int k=0; k<grid[i/20][j/20].neighbors.size(); ++k) {
if... |
cbec45ea-1a47-4a0a-85de-67952c22d690 | 4 | public static double getDouble() {
double x = 0.0;
while (true) {
String str = readRealString();
if (str == null) {
errorMessage("Floating point number not found.",
"Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE);
}
... |
5b5d3a3d-d53c-44b7-af9b-3b42b29957a7 | 6 | public void changePicture() throws InterruptedException{
//Get Image Name
path = getImageName();
//If image exists try to change the image
if(path!=null&&!path.equals("")){
try{
//Read in the new file
profileImage = ImageIO.read(new Fi... |
f0f8c4e5-331c-43da-b275-a0c6a122f883 | 6 | private static Board calculateTokenPositions(Size boardBounds,
LinkedList<Circle> redTokens, LinkedList<Circle> yellowTokens) {
Board result = new Board();
final float BLOCK_WIDTH = (float) boardBounds.width / Board.COLUMNS;
final float BLOCK_HEIGHT = (float) boardBounds.height / Board.ROWS;
for (int row = 0... |
0b42b23f-f41d-4230-b12a-872601bed59d | 0 | public void setXY(Piste piste) {
this.x = piste.getX();
this.y = piste.getY();
} |
da6d5996-a49d-47fd-a8e7-408a37b6f9cc | 9 | public static void writeScripts(){
/////////////////////////////////////////Create Properties///////////////////////////////////////////////
GenerateCommon gc=new GenerateCommon();
HashMap<String,ArrayList<String>> tlur=readTablesList();
if(tlur==null)
return;
ArrayLi... |
8d7022f8-7b5e-47f5-8e72-24f66949889c | 7 | public void initialize() {
for( Long rootId : roots ) {
Queue<Long> q = new LinkedList<Long>();
q.add(rootId);
while ( !q.isEmpty() ) {
Long id = q.poll();
String text = getProcessedTweet(tweetMap.get(id).getTweetText());
... |
f50f5ea5-edb4-4376-97af-2172c091b9d0 | 0 | @Override
public void windowDeactivated(WindowEvent e) {
} |
d0596527-4d43-4c5b-8a8e-2aca0e01ea5f | 4 | public Timer getTimer() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getTimer() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getTimer() END");
}
return m_timer;
} |
79c76412-a914-4f27-b775-8361425986ad | 8 | private void applyViewerLabel(ViewerCell cell, ViewerLabel label) {
if (label.hasNewText()) {
cell.setText(label.getText());
}
if (label.hasNewImage()) {
cell.setImage(label.getImage());
}
if (colorProvider!= null || label.hasNewBackground()) {
cell.setBackground(label.getBackground());
}
if (col... |
fef220bf-6420-4391-a7c7-b6b93175d562 | 3 | public String mapFieldName(String cls, String name, String descriptor) {
// Check the class itself first.
String key = cls + "/" + name;
if (fields.containsKey(key)) {
return fields.get(key);
}
// Then all of its ancestors
for (String ancestor : inheritance.g... |
f1c52147-5061-4b3d-9ff1-cef3e7b0f49e | 7 | @Override
public String execute() {
String actionResult = "";
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("USER");
setCurrentUserName(user.getFname() + " " + user.getLname());
UserBusinesService userBusinesService = n... |
3af315fc-0c6f-4208-89d9-dbb63bf7c44a | 4 | protected boolean decodeFrame() throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out==null)
return false;
Header h = bitstream.readFrame();
if (h==null)
return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer)decoder.decod... |
592f65dd-b609-45c8-aa5d-920baea68989 | 8 | @Override
public boolean equals(final Object object) {
if (object == this) return true;
if (!(object instanceof Conversion<?, ?>)) return false;
final Conversion<?, ?> data = (Conversion<?, ?>)object;
return Objects.equals(this.output(), data.output());
} |
2bc72fea-be36-44f3-a63c-8ed2efafde93 | 3 | public void generate_test() {
boolean lowerTail = true;
for (int i = 0; i < numTests;) {
int N = rand.nextInt(MAX) + 1;
int D = rand.nextInt(N) + 1;
int n = rand.nextInt(N) + 1;
int k = Math.max(rand.nextInt(Math.min(n, D)), 1);
if (Hypergeometric.get().checkHypergeometricParams(k, N, D, n)) {
d... |
2504aaa6-96e4-408a-ba7a-b33956085165 | 2 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation % 2 == 1) {
g.drawRect(50, 85, 100, 30);
g.drawLine(0, 100, 50, 100);
g.drawLine(150, 100, 200, 100);
g.drawLine(45, 130, 155, 70);
g.drawLine(145, ... |
d0092f33-4b48-41d9-a8fc-a169554c7923 | 6 | public void SetText(){
for(int i = 0 ; i < 24; i++)
{
((JTextField) a [i]).setText(labels.elementAt(i));
}
for(int j = 0 ; j < 24; j++)
{
((JTextField) b [j]).setText(instruct.elementAt(j));
}
for(int k = 0 ; k < 24; k++)
{
((JTextField) c [k]).setText(operator.elementAt(k));
}
... |
e31e07b7-a307-4630-b566-f3940574e9b8 | 8 | public void isKingInCheckNotifier()
{
String currentTurnColor = whitePlayerTurn() ? white : black;
Position whiteKingPosition = team.getKingFromWhiteTeam();
Position blackKingPosition = team.getKingFromBlackTeam();
// detects if and when check and/or check mate happens
if(whitePlayerTurn())
{
if(isKi... |
ff584f16-f65b-4a83-85ca-066c61fec6bd | 4 | public static void printPrimaryNumbers(int lessThan) {
if(lessThan < 2) {
System.out.println("No primary numbers less than 2");
}
System.out.println(2);
for(int i = 3; i < lessThan; i += 2) {
int sq = (int)Math.round(Math.sqrt(i));
for(int j = 3; j < s... |
2ffec4e0-42fc-4665-afd0-f0c0cc266dd6 | 0 | public void setId(Long id) {
this.id = id;
} |
68468e05-ecd9-4b45-b689-d9285c4d4f3c | 4 | public static void insertStaff(Staff staff){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Login login = staff.getLogin();
try{
conn... |
9439fada-eef5-4ac3-897e-f709e8f06319 | 6 | static final int method592(boolean bool, byte i, boolean bool_0_, int i_1_,
int i_2_) {
anInt1105++;
if (i != -128)
return -20;
Class348_Sub13 class348_sub13
= Class258_Sub4.method1974((byte) -1, i_1_, bool_0_);
if (class348_sub13 == null)
return 0;
int i_3_ = 0;
for (int i_4_ = 0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.