method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5f4e8176-28df-4132-8dad-11d817a2b97b | 7 | private void unicast (Message m, int delay) {
int src = m.getSource();
int dst = m.getDestination();
Record source = r.find (src);
Record destination = r.find (dst);
if ((source == null) || (destination == null)) {
/* In this unlikely event. */
String msg =
String.format("Error: link <P%d, P%d... |
f59dc8cf-fa1e-4ec5-9fdb-63a40358ded4 | 9 | protected boolean eval(IEvaluationContext context, Expr a, boolean strict)
throws ExprException {
if (a == null)
return true;
if (a instanceof ExprEvaluatable) {
a = ((ExprEvaluatable) a).evaluate(context);
}
if (a instanceof ExprNumber) {
... |
1f52d268-4268-490b-b3b8-30c7aa472f35 | 5 | private static boolean Biparticao_Visit(Graph grafo, int u, int[] cor, int corPai) {
if (corPai == 1) {
cor[u] = 2;
} else {
cor[u] = 1;
}
for (int i = 0; i < grafo.getNlc(); i++) {
if (grafo.getElement(u, i) > 0) {
if (cor[i] == cor[u])
return false;
if (cor[i] == 0)
Biparticao_Visit... |
55d1a52a-226f-442e-9e88-8d82846efcc1 | 4 | protected final void onKeyPress(char var1, int var2) {
if(var2 == 14 && this.name.length() > 0) {
this.name = this.name.substring(0, this.name.length() - 1);
}
if("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_\'*!\"#%/()=+?[]{}<>".indexOf(var1) >= 0 && this.name.length... |
a569adf7-5d34-4098-8b78-1c9d4faaa98f | 4 | private void addDirNode(final Element root, final File dir)
{
final Element dirnode = new Element("Directory");
root.addContent(dirnode);
dirnode.setAttribute("name", dir.getName());
final File[] list = dir.listFiles();
for (final File f : list) {
if (f.isFile() && f.exists()) {
this.progressModel... |
02b6ac15-5e6d-47bc-a855-76ace077e3a0 | 0 | @Test
public void getVertexSetNeigourhoodTest2(){
VertexSet s = new VertexSet();
s.addVertex(city_graph.getCity(0));
s.addVertex(city_graph.getCity(1));
VertexSet v = city_graph.getVertexSetNeighbourhood(s);
VertexSet expect = new VertexSet();
expect.addVertex(city_graph.getCity(9));
expect.addVertex(... |
e3685c24-7024-4339-8d8b-178b719f7b28 | 3 | @Override public void init() {
control = new HeatControl();
control.setTargetEnabled(true);
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(long now) {
if (now > lastTimerCall + 1_000_000_000l) {
... |
c9b2fc7f-5c64-45fd-8bf0-f62af91151db | 0 | public String getName() {
return name;
} |
632cf629-fa4e-43c8-a03b-b8af991b551f | 2 | public Class<? extends Annotation> annotationOf(Field field) {
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
return item.getAnnotation();
}
return null;
} |
9121ace1-27ed-45be-bff3-40fc22681594 | 0 | @Test
public void testSetState() throws IOException {
System.out.println("setState");
int newState = 9;
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
instance.setState(newState);
} |
45ac5658-8c2b-483c-8269-58636348d021 | 1 | @EventHandler
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
if (event.getDestination().getHolder() instanceof Hopper) {
Hopper hopper = (Hopper) event.getDestination().getHolder();
hopperHandler(hopper, event.getItem(), event);
}
} |
08e64956-c038-4780-99ca-00e2d49c07fd | 4 | public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... |
81c41e7a-85ee-4d61-bca0-ccd3aa753567 | 5 | @Override
public void process(ConsoleCommandContext consoleCommandContext) {
final String argument1 = getArgument(consoleCommandContext, 1);
final String argument2 = getArgument(consoleCommandContext, 2);
String column = argument1.substring(0, 1);
String row = argument1.substring(1, 2);
int columnIndex = -1;... |
8c728266-9aed-43e6-af7b-b535480af87d | 7 | public static void AdjustSaturation(BufferedWrapper bw, int adjustQuantity)
{
Color newColor;
float[] hsbvals = new float[3];
float saturation;
BufferedImage bi2 = new BufferedImage(bw.img.getWidth(), bw.img.getHeight(), bw.img.getType());
for (int x = 0; x < bw.img.getWidth(); x++)
{
f... |
13717155-bfe3-4908-85d5-97632e68df54 | 0 | public List findByProblemId(Object problemId) {
return findByProperty(PROBLEM_ID, problemId);
} |
98b4b1f7-1872-4823-9fe5-cbda65c80638 | 1 | public void keyPressed(KeyEvent e) {
GameAction gameAction = getKeyAction(e);
if (gameAction != null) {
gameAction.press();
}
// make sure the key isn't processed for anything else
e.consume();
} |
027b3e0a-2a4b-4936-a699-bbbfd929b33f | 9 | public static Set<PosixFilePermission> toPosixPermissions(int mode) {
Set<PosixFilePermission> permissions = new HashSet<>();
if ((mode & 0b001_000) == 0b001_000) {
permissions.add(PosixFilePermission.GROUP_EXECUTE);
}
if ((mode & 0b100_000) == 0b100_000) {
permissions.add(PosixFilePermissio... |
050393df-afde-46fc-9a90-eb25d7ff7567 | 8 | public void run() {
String inputLine, outputLine;
System.out.println("\tHilo iniciado");
try {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
inputLine = in.readLine();
//while ( !(inp... |
beb0888d-c8b9-4a43-bcb6-9babb7fc00ea | 0 | public RORobotInstance() {
joystickHandler = new ROJoystickHandler();
dashboardData = new RODashboardData();
packetTransmitter = new ROPacketTransmitter(joystickHandler);
packetTransmitter.setDashboardData(dashboardData);
} |
671bc23a-6648-43f5-b25b-c88f260f0271 | 3 | public static boolean downloadHookLibrary(LauncherFrame frame, String baseURL)
{
Util.Family family = Util.getFamily();
Util.Arch arch = Util.getArchitecture();
String extension = Util.getNativeExtension();
if(family == Util.Family.UNSUPPORTED || arch == Util.Arch.UNSUPPORTED)
return false;
String file = ... |
d2c7635e-4420-4dea-8746-04b93a626544 | 8 | public static String compress(String s) {
String dest = "";
if (s.length() == 0) return s;
char c = s.charAt(0);
for (int i = 1; i < s.length(); i++) {
if (c == ' ' &&
((s.charAt(i) == ' ') ||
(s.charAt(i) == ',') ||
(s.charA... |
20a297f9-3e68-41f8-b7bf-9df5f7cfc181 | 2 | public static void main(String[] args)
{
Exception3 e1 = new Exception3();
try
{
e1.method("hello");
}
catch(MyException e)
{
System.out.println("进入输入是null的异常!before");
e.printStackTrace();
System.out.println("进入输入是null的异常!after ");
}
// catch(MyException1 e)
// {
// System.out.println("进... |
aa8c28d6-c04e-400c-8940-ace38de183f4 | 4 | public void closeConnections() {
try {
if (myResultSet != null) {
myResultSet.close();
}
if (myPreparedStatement != null) {
myPreparedStatement.close();
}
if (connect != null) {
connect.close();
}
} catch (Exception e) {
System.out.println(e.toString());
// Ein Dialogfenster... |
605db2e2-32df-4a69-bb1c-13be1d62ee2a | 2 | public void updatePercent(){
pastPrices.add(price);
if (pastPrices.size() > 300)
pastPrices.remove(); // remove oldest price after 300 passed
double oldP = pastPrices.peek(); // oldest value in queue
percentChange = ((price - oldP)/price) * 100;
percentChange = (double)(Math.round(percentChange * 100)) / 100;... |
2ba7c888-84be-4566-a91e-ca3d0ee667d5 | 9 | private static double[] toLab(final int red, final int green, final int blue)
{
//The weight of chromaticity [0, ∞[, 1 is unweighted.
final double chromaWeight = 1;
int ir = red ; if (ir < 0) ir += 1 << 8;
int ig = green; if (ig < 0) ig += 1 << 8;
int ib = blue ; if (ib < 0) ib += 1 << 8;
do... |
99e7c2cb-e3a6-41eb-8138-518d178fb4c8 | 1 | private String drop() {
StringBuilder sb = new StringBuilder();
sb.append( "DROP TABLE " + table.getTableName() + ";\n" );
if ( buildSequence ) {
sb.append( "DROP SEQUENCE " + table.getTableName() + "_SEQ;\n" );
}
return sb.toString();
} |
75647a72-95d0-4f31-bcc2-161c5411db15 | 2 | public void run() {
while(true) {
System.out.print(this);
if (--countDown == 0)
return;
}
} |
62a79467-21c5-47c7-a413-c323e1202de9 | 1 | public static boolean getMouseDown(int mouseButton)
{
return getMouse(mouseButton) && !lastMouse[mouseButton];
} |
bef75c49-cb12-4e33-8fb0-9ae08d51d2b2 | 7 | static String getValidFeedback(String code, String guess){
if (code.length() != guess.length()){
return "0b0w";
}
int b = 0;
int w = 0;
Map<String,Integer> codeMap = new HashMap<String,Integer>();
Map<String,Integer> guessMap = new HashMap<String,Integer>();
for (int i = 0; i < code.le... |
f57a32d4-64b4-4862-8d9c-129e5d8dd2e7 | 8 | @SuppressWarnings("rawtypes")
public Map activity(String uid, String rewardId,
Map<Integer, String> priceMap) {
Connection connection = DBconnection.getInstance();
Statement stmt;
String value = null;
try {
stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("");
while (rs.next()... |
14cac064-70d9-4f41-b20c-acfe3b1384a5 | 2 | public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage: java UnitsConverter <weight in pounds>");
System.exit(0);
}
numberToConvert = Double.parseDouble(args[0]);
System.out.println("lbs " + args[0] + " equals:\n");
for (Converter converter : Converter.values()) {
... |
4e6b26bb-530f-4ea6-83bc-127b1eb98e75 | 4 | public void setDisplay(int[][] values) {
if(values.length== PAGE_SIZE && values[0].length== PAGE_SIZE) {
for(int row = 0; row < values.length; row++) {
for(int col = 0; col < values[row].length; col++) {
userValues[row][col] = values[row][col];
}
... |
8e6fee89-0f30-4ea5-8a40-2794b05b2728 | 3 | public void finish ()
{
boolean noNukes = false;
try {
checkTalking ();
get (RIO_COMM_END, 0, 0);
get (RIO_UNKNOWN_42, 0, 0);
} catch (IOException e) {
// ignored
} catch (IllegalStateException e) {
noNukes = true;
} finally {
if (!noNukes)
talking = null;
}
} |
cdb4f174-3878-4a9d-af7d-60acdd45836c | 3 | @Override
public void run()
{
while (running)
try
{
Task t = taskQueue.take();
if (chunks.isTaskStillValid(t))
{
chunks.setChunk(t.px, t.pz, chunks.makeChunk(t.px, t.pz));
... |
7a90ae41-e881-4b64-a495-345536cfd2a7 | 3 | public static String printLine(String... values) {
// set up a CSVUtils
StringWriter stringWriter = new StringWriter();
CSVPrinter csvPrinter = new CSVPrinter(stringWriter);
// check for null values an "null" as strings and convert them
// into the strings "null" and "\"null\""
... |
6a537e35-6fc7-4bc8-b2d9-2205665aaf10 | 7 | private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 3; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2()... |
074bf6e8-007c-4253-a9fd-0caaacaf46b8 | 4 | public ArrayList<Piece> getPieces(boolean color)
{
ArrayList<Piece> answer = new ArrayList<Piece>();
for(Piece[] pieces:theGrid)
{
for(Piece p : pieces)
{
if(p!=null&&p.isWhite()==color)
{
answer.add(p);
}
}
}
return answer;
} |
128bc310-c1d9-48e8-9841-f77058e4e8f4 | 0 | public String getName(){
return name;
} |
0122d3d4-d4a3-47bf-af34-d89d5d4dbeea | 5 | public String setUpdate() {
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() && file.getName().endsWith(".mail") && file.getName().startsWith("TODEL")) {
file.delete();
}
}
}
ret... |
4d646850-8306-459e-ba0c-647d8f535e13 | 9 | private void parsePath(List list, String path) {
if (path == null) {
return;
}
if (path.length() == 0) {
// is_absolute_path is ambiguous so we won't change anything
this.file = null;
return;
}
// Determine if the path is absolute
if (path.startsWith(PATH_DELIM)) {
this.is_absolute_path... |
3e025a25-0798-44a2-97a5-e4e0808f5752 | 1 | public static byte[] readFile(String dir, String filename)
{
FileInputStream fileInputStream=null;
File file = new File(dir+"/"+filename);
byte[] bFile = new byte[(int) file.length()];
try {
fileInputStream = new FileInputStream(file);
fileInputStream.read(bFile);
... |
27c3719d-b16e-4dec-aa25-e5b8d2f4adaa | 4 | public PluginLoader(String directory, Class<? extends IPlugin> type) throws MalformedURLException {
// check whether the URL is a directory
File dirFile = new File(directory);
if (dirFile == null || ! dirFile.isDirectory()) {
String errmsg = directory + " is not a directory";
logger.warning(errmsg);
... |
83968a40-6723-4a6a-9186-fc14c97d8e7d | 2 | @Override
public void reduce(IntWritable key, Iterable<Text> values,
Context context)
throws IOException, InterruptedException {
Map<String, Double> temp= new HashMap<String, Double>();
for (Text value : values) {
String countryName = value.toString();
if(temp.contai... |
99c82b4a-bbb6-4ba2-ae4f-81cf7d8fd247 | 7 | public static PropertyValue getPropertyValue(String property, RDFNode n) {
PropertyValue p = new PropertyValue();
p.setProperty(property);
if (n.isResource() || n.isURIResource()) {
p.setType(PropertyType.URI);
p.setValue(n.asResource().getURI());
} else if (n.isLiteral()) {
Literal l = n.asLiteral();
... |
05969e6c-5b6d-43ac-b467-d1787f590ab3 | 7 | public CustomWorld(final World w) {
super();
this.w = w;
gp.renderWorld(w);
setLayout(new FlowLayout());
add(xCoorL);
add(yCoorTF);
add(yCoorL);
add(xCoorTF);
add(doneBut);
add(cancelBut);
add(elementBox);
add(addBut);
add(gp);
Util.cntrl = new Controller(w);
addBut.addActi... |
55d50276-95d0-42c0-8727-019fb300b381 | 1 | public void updateFromScorecard(ScorecardSummary summary) {
addAlbatrosses(summary.getAlbatrosses());
addPars(summary.getPars());
addBirdies(summary.getBirdies());
addBogeys(summary.getBogeys());
addDoubleBogeys(summary.getDoubleBogeys());
addTripleBogeys(summary.getTripleBogeys());
addEagles(summar... |
41debc83-fff6-49ed-88d7-1b0c24540b8b | 3 | private void txtHome_telephone_NumberKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtHome_telephone_NumberKeyPressed
if (evt.getKeyCode() == 38) {
txtAddress.grabFocus();
} else if (evt.getKeyCode() == 40) {
txtMother_Name.grabFocus();
} else if (evt.getKeyCode() == 37) {
... |
7204d3cd-9adf-4ce6-8cd3-8db9a9858243 | 8 | public void execute(List<String> inputs, StringBuilder output) {
Map<String, TokenIdentifier> identifiers = new HashMap<String, TokenIdentifier>();
for (String input : inputs) {
output.append("Lexer\n");
Lexer lexer = new Lexer();
Parser parser = new Parser();
Evaluator evaluator = new Evaluator();
... |
1e69b454-4622-4359-8484-7cda6d8f4766 | 8 | private boolean searchUpForNextSupersetNode( Node node, K key, Object[] ret ) {
if( node.mRight != null && mComp.compareMaxes( key, node.mRight.mMaxStop.mKey ) <= 0 ) {
// Request downward search on right subtree.
ret[0] = node.mRight;
return false;
}
while( ... |
d6ff6789-ebf7-4d9a-9e71-e7b84c515378 | 6 | private static void initialize(){
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)... |
0f1d39a6-de08-4db1-b5bc-a12b91b878a0 | 8 | public void setSize(int width, int height) {
if (width < 0 || height < 0
|| width > RASTER_MAX_WIDTH || height > RASTER_MAX_HEIGHT) {
// Invalid width or height.
throw new ExceptionInvalidParam();
} else if (width == 0 || height == 0) {
// An empty noi... |
8ccf6645-dbee-469b-b8d1-df40071c3ff7 | 3 | public static LinkedHashMap<String,Object> arrayListToLinkedHashMap(ArrayList<?> arr) {
if (arr == null) return new LinkedHashMap<String,Object>();
//is this the same as arr2hm?
int i=0;
LinkedHashMap<String,Object> hm = new LinkedHashMap<String,Object>();
for (Object value: arr) {
hm.put(String.valueOf(i... |
ffb44400-243a-4d46-b8f1-35b58cd196f8 | 8 | private static void printExceptPublicMembers(Member[] mems){
for (Member m : mems) {
Annotation[] annotations = new Annotation[0];
if (m instanceof Field) {
annotations = ((Field)m).getAnnotations();
}
if (m instanceof Constructor) {
annotations = ((Constructor<?>)m).getAnnotations();
}
if ... |
97c378b2-8b90-462d-8281-8e8d0ed49bd4 | 0 | public static void main(String[] args) throws IOException {
LockManager manager = new LockManager("230.0.0.1", "Node1");
manager.start();
} |
6c07a329-9a4f-4be0-a6ea-c1d67fa36360 | 0 | public MultiplePane(JSplitPane split) {
super(new BorderLayout());
add(split, BorderLayout.CENTER);
mySplit = split;
} |
33570c88-2d5a-4a5d-a785-ae82e4d7396b | 7 | public void resoutRatio(Probleme p) {
int bestScore = p.valeurSelection();
double[][] tab = ratio(p);
double tmp = 0, tmp2 = 0;
for (int d = p.nombreItem(); d != 0; d--) {
for (int a = 0; a < d; a++) {
if (tab[a][0] < tab[a + 1][0]) {
tmp = tab[a][0];
tmp2 = tab[a][1];
tab[a][0] = tab[a + ... |
374aebd0-cadb-4d83-abcc-94c48dd2c109 | 1 | public static void main(String[] args){
System.out.println("Hello World");
int[]s = {4,1,0};
List<List<Integer>> result = new ArrayList<List<Integer>>();
result = new Subsets().subsets(s);
for(int i = 0 ; i< result.size();i++)
System.out.println(Arrays.toString(result... |
7a5e58af-13b5-4bcb-a6f3-fcdb65e31831 | 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... |
ff3db7b0-104f-4ad1-9a40-629d2ba8102e | 7 | public void renderCrisis() {
if(b)
i++;
else {
i--;
}
if(i >= 100) {
b = false;
}
else if(i <= 0) {
b = true;
}
Iterator<IScreenItem> it = screenItems.descendingIterator();
boolean bgDone = f... |
cab5678c-39cb-4b65-a350-6916c08b423c | 9 | public static String getMarkerSVG( double x, double y, String clr, int marker )
{
String markersvg = "<use x='" + x + "' y='" + y + "' stroke='" + clr + "' fill='" + clr + "' xlink:href='#";
if( marker == 1 ) // square
{
markersvg += "square1'/>";
}
else if( marker == 2 ) // diamond
{
markersvg += "d... |
87a19ff1-8e5e-4fdf-8a0c-4205e9fcc988 | 4 | @Override
public void confirmQuotes(String clientName) throws ReservationException {
Set<Reservation> newReservations = new HashSet<Reservation>();
try {
for (Quote quote : this.quotes) {
CarRentalCompany company = RentalStore.getRentals().get(quote.getRentalCompany());
... |
cf1d717f-40a8-4f4e-bba3-9b7fc2d3d7ab | 8 | public static boolean checkPlaceRoomBounds(int x, int y, Room room,
int ratioX, int ratioY, int rotation) {
if (x == 0 && room.hasWestDoor(rotation))
return false;
if (y == 0 && room.hasSouthDoor(rotation))
return false;
if (x == ratioX - 1 && room.hasEastDoor(rotation))
return false;
if (y == ratio... |
2af73b3b-c496-4940-a687-7364512fc708 | 2 | public boolean isNewline(String ign) {
return ign.equals("\n")||ign.equals("\r")||ign.equals("\r\n");
} |
4c1d3f51-eaef-43b3-9d5f-208c21b62c69 | 6 | public int diff_xIndex(LinkedList<Diff> diffs, int loc) {
int chars1 = 0;
int chars2 = 0;
int last_chars1 = 0;
int last_chars2 = 0;
Diff lastDiff = null;
for (Diff aDiff : diffs) {
if (aDiff.operation != Operation.INSERT) {
// Equality or deletion.
chars1 += aDiff.text.leng... |
4b4059a3-9e03-4ea3-bf02-40d292fbf837 | 7 | public synchronized boolean moveDown(int slotID) {
if (!_isOpen) {
return false;
}
if ((slotID < 0) || (slotID >= _slots.size())) {
return false;
}
if (!_slots.get(slotID).isOccupied()) {
return false;
}
int nextSlotID ... |
e948f40b-27cf-4f7d-ba3f-2869cb474c47 | 9 | public void listenUser(){
MeinScanner myscan = new MeinScanner();
ArrayList<Object> liste = myscan.scanInput();
if(liste == null){
System.out.println("Befehl nicht verstanden!");
this.listenUser();
}else if(liste.get(0)=="Add" && liste.get(1)!=null){
... |
92fa5d54-548e-4eb1-84b4-89940c746fce | 2 | public void refresh(){
int i,j;
this.ventana.remove(panel);
panel=new JPanel();
panel.setLayout(null);
for(i=0;i<15;i++){
for(j=0;j<15;j++){
this.panel.add(buttonMatrix[i][j].boton);
}
}
this.ventana.getContentPane().add(panel);
this.ventana.setVisible(true);
} |
f1492243-b899-4490-8f91-8b4963aee18c | 8 | @Override
public void handleCloseElementEnd(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws ParseException {
if (!this.insideAllSelectorMatchingBlock) {
this.someSelectorsMatch = false;
... |
49e15d79-e631-47e7-8b28-74fde90ab0b2 | 1 | public StoneStair(Point p, boolean up) {
super(p);
this.up = up;
if (up) {
flagCommand(Command.UP);
addFlag(EntityFlag.POINT_MOVE_UP);
controller = new StairController(this, up, EnviroSprite.stone_stair_up);
} else {
flagCommand(Command.DOW... |
580c09dc-6549-405f-8d53-67838620860e | 8 | private BitSet selectRectangles(String str) {
int n = view.getNumberOfInstances(RectangleComponent.class);
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
for (int i = 0; i < n; i++) {
if (view.getRectangle(i).isSelected())
bs.set(i);
}
return bs;... |
66cb831c-211b-4a69-9714-39d82b37e8de | 2 | protected boolean isFinished() {
return super.isFinished() || Robot.oi.getLeftDrive() != 0 || Robot.oi.getRightDrive() != 0;
} |
21527121-5b30-4f6a-b3af-8376e78e6f6a | 0 | @Override
public void awardPoints(int amount) {
points += amount;
} |
2a85018f-3714-490f-914e-0ce7091bef2f | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addTreeSelectionListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} |
4266d605-8f2b-4755-8c3e-e49a8ede5c77 | 3 | protected void maintainScrollBar(boolean horizontal, double factor,
boolean center)
{
JScrollBar scrollBar = (horizontal) ? getHorizontalScrollBar()
: getVerticalScrollBar();
if (scrollBar != null)
{
BoundedRangeModel model = scrollBar.getModel();
int newValue = (int) Math.round(model.getValue() * ... |
6c40330c-9865-4128-852d-c02887e95b9d | 9 | @Override
public void run() {
try {
synchronized (this) {
while (true) {
while (ofertasRecursosLivres.isEmpty()) {
wait(tempoWaitVerificacoesLocais);
}
OfertaEmprego empregoLivre = buscarOfertaEmp... |
b73368af-dfd9-4ebb-a4c9-9bf14b286905 | 4 | private void added (DeviceImpl dev)
{
if (Windows.trace)
System.err.println ("notify add " + dev);
// call synch'd on devices
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try { listener.deviceAdded (dev); }
catch (... |
0a61eb09-6884-4255-ba0b-b72bbf3ab96a | 0 | @Override
public int getLoginTimeout() throws SQLException {
return 0;
} |
f8f73e71-c682-4149-badf-9de1b5eab2d8 | 1 | public void inicio(AreaFormacao areaformacao) throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(areaformacao.getId());
id.setEditable(false);
id.setEnabled(false);
nome = new JTextField(areaformacao.getNome() == null ? ""
: areaformacao.getNome());
JPanel pp = new JPanel();
Design... |
19784f11-6eb5-4469-9b17-ccd28fe06774 | 8 | boolean anyMove (int x,int y, OthelloPiece colour){
boolean valid = false;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_2,colour)) valid=true;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_3,colour)) valid=true;
if(move(x,y,VALID_MOVE_3,VALID_MOVE_1,colour)) valid=true;
if(move(... |
43b7cd88-76e1-451a-a5e6-9231705db092 | 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... |
4104aad6-0671-4359-9d70-0e6ffaa41fd4 | 7 | private int playSecondThrow(Player player, PlayerFrameHistory frame, int previousThrowScore) {
int maxPossibleScore = 10-previousThrowScore;
int score = -1;
do {
System.out.print("How much did you score, " + player.getName() + "? (Type 'exit' to interrupt the game)");
S... |
b3ad5984-2a4a-4889-88a9-c41cc55a4387 | 0 | @Override public void sign(String apikey) {
this.apikey = apikey;
} |
30cd13f5-40a6-4d66-acc3-d6b6e83e9b9c | 2 | public LogInFrame() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().setLayout(new MigLayout("", "[fill][185.00][30.00][41.00]", "[][][][][][][][fill][pref!,center][][][][][]"));
setSize(275,450);
JLabel usernameLabel = new JLabel("Username:");
usernameLabel.setHorizontalAlignment(SwingConstants.LE... |
51bb224b-0abd-4cc2-9864-d19b3a6a1dfb | 6 | private void fillRandomItems(String string, int amt, int index) {
// fills a random item into the contents array
switch (string) {
case "gun":
contents[index] = getRandomGun();
break;
case "sword":
contents[index] = getRandomSword();
break;
case "item":
contents[index] = getRandomItem();
br... |
2c019e2a-dc60-4704-bf4e-de7d032c8cb2 | 5 | public static void startUploading(String url) {
if (url == null) {
BmLog.error("Cannot start SamplesUploader: server did not send callBack URL");
return;
}
callBackUrl = new StringBuilder(url);
samplesUploaderThread = new Thread(new Runnable() {
@Overr... |
fd6c8a69-84a5-4ad9-8f22-eafeac4338f3 | 4 | public boolean handleRightClick(Point clickPoint) {
if (shouldRender) {
HUDArea hudArea = null;
if (isInside(clickPoint)) {
//start from the top and work our way down to "layer" the huds
for (int i = (hudAreas.size() - 1); i >= 0; i--) {
... |
3f126425-de6c-4774-8211-0d9ff2669ce4 | 7 | protected String getUndoText() {
if (!canUndo()) {
return "Cannot undo.";
}
int i = insertionPoint - 1;
for (; (i >= 0) && (!edits.get(i).isSignificant()); i--) {
String description = edits.get(i).describeUndo();
if (!description.equals("undo")) {
... |
905b5bdc-cd26-4b05-8f60-fe572325f161 | 7 | public static String formatString(final boolean format, final CharSequence object) {
if (object == null) return "null";
final String space = (format ? "\\n\"+\n\"" : "\\n");
final StringBuilder result = new StringBuilder("\"");
int last = -1, next = 0;
final int size = object.length();
while (next < size) {... |
c81a7bdb-b938-410d-b1c5-919f0cd664a1 | 8 | public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par7 == 0)
{
return false;
}
else if (par7 == 1)
{
return false;
}
else
{
... |
dd0047b3-0e4c-4bfd-b012-adfa51e0a776 | 3 | public static List<Long> getUnique(List<Long> ids) {
Long[] idsArray = ids.toArray(new Long[ids.size()]);
Arrays.sort(idsArray);
List<Long> uniqueList = new ArrayList<Long>();
for (long id : idsArray) {
if (uniqueList.isEmpty() || (id != uniqueList.get(uniqueList.size() - 1))) {
uniqueLi... |
fbfaf3d5-3837-46f6-9f31-d2e2ea51409e | 9 | public int[] attack(Country t1, Country t2) {
int[] result = new int[3];
result[0]=0;
result[1]=0;
result[2]=0;
if (gameState==STATE_ATTACKING) {
if (
t1!=null &&
t2!=null &&
t1.getOwner()==currentPlayer &&
t2.getOwner()!=currentPlayer &&
t1.isNeighbours(t2) &&
// t2.isNeig... |
0d2347b3-308c-4451-bf29-3ebe1691388c | 9 | public static boolean getDataMaskBit(int maskPattern, int x, int y) {
if (!QRCode.isValidMaskPattern(maskPattern)) {
throw new IllegalArgumentException("Invalid mask pattern");
}
int intermediate, temp;
switch (maskPattern) {
case 0:
intermediate = (y + x) & 0x1;
break;
... |
9ca1896b-1a42-410c-b7f5-e7b74793983a | 8 | static void warshallFloydWithPath(int[][] dists, int[][] path) {
int n = dists.length;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
path[i][j] = j;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int ... |
ec548a53-68f6-4f70-890e-0661a37a2d37 | 5 | public void addBanner(Banner banner) {
if (banner != null) {
if (banner.getBannerType() == BannerListType.SERIES) {
addSeriesBanner(banner);
} else if (banner.getBannerType() == BannerListType.SEASON) {
addSeasonBanner(banner);
} else if (banne... |
5257847a-7d04-4661-b8db-c28f0c0b3c98 | 7 | public void updateMidiInSelectedItems(String[] midiInDevices) {
for (int i = 0; i < midiInMenu.getItemCount(); i++) {
String name = midiInMenu.getItem(i).getText();
if (name == null || name.equals("No MIDI Input Devices Enabled")) {
continue;
}
Str... |
25cd84f0-a65a-4b08-b742-c527beed7e44 | 3 | public void jumpTo(int paramInt)
{
if (paramInt < 0)
this.CurrentIndex = 0;
if (paramInt >= this.Indexes.length)
if (this.Loop)
this.CurrentIndex = (paramInt - this.Indexes.length);
else
this.CurrentIndex = (this.Indexes.length - 1);
setImage(this.Cells[this.Indexes[this.... |
3c47bfac-9d10-463e-b67d-432ee808993a | 8 | @SuppressWarnings("rawtypes")
public static void settingsDialog(){
final JFrame f = new JFrame();
JTabbedPane mainPane = new JTabbedPane();
JPanel buttonPanel = new JPanel();
CBeanRolloverButton ok = CBeanRolloverButton.GetOkButton("OK","Save the settings");
CBeanRolloverButton cancel = CBeanRolloverButto... |
98b5ad09-c10e-41a4-bbc3-9d10d36b9221 | 2 | @Override
public boolean equals(Object other)
{
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return isEqual(this.first, otherPair.first) &&
isEqual(this.second, otherPair.second);
}
return false;
} |
2bed1542-ae89-4f87-92d7-d5e7b1d6cd31 | 9 | public RegisterPanel(FacelookInitGUI j) {
super();
container = j;
this.setBackground(Color.decode("#3b5998"));
this.setBorder(new EmptyBorder(5, 5, 5, 5));
this.setLayout(new MigLayout("", "[grow]", "[][][][][][][][]"));
JLabel lblFacelook = new JLabel("Facelook");
lblFacelook.setForeground(Color.WHITE... |
26042b3d-3463-4dad-86b4-9dc5c9d914d9 | 0 | public void setNote(String note) {
this.note = note;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.