method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cc6d6a5d-f133-4f6c-9b03-14c20874e17f | 1 | public synchronized boolean remover(int i)
{
try
{
new InstituicaoSubmissaoDAO().remover(list.get(i));
list = new InstituicaoSubmissaoDAO().listar("");
preencherTabela();
}
catch (Exception e)
{
return false;
}
return true;
} |
97ec29a3-4225-4241-9344-fe07a8eb5669 | 0 | public static User create(String username, String passwordClear, String fullName, String email) throws SQLException {
String passwordHashed = hashPassword(passwordClear); // hash the password
User rtn = new User();
rtn.username = username;
rtn.passwordHashed = passwordHashed;
rtn.isAdmin = false;
rtn.fullN... |
687eec70-e5c1-4e7e-878d-9019bce46b8e | 8 | public Set<Map.Entry<Long,Long>> entrySet() {
return new AbstractSet<Map.Entry<Long,Long>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TLongLongMapDecorator.this.isEmpty();
}
public ... |
29e1bc63-7a38-4d0d-81a7-18a3df50e95a | 0 | @Test
public void testSequentialComputation(){
calculator.pushOperand(4.0);
calculator.pushOperand(7.0);
calculator.pushPlusOperator();
calculator.evaluateStack();
calculator.pushOperand(3.0);
calculator.pushTimesOperator();
calculator.evaluateStack();
assertEquals(33.0, calculator.popOperand(... |
bde60db3-2828-41d8-befe-22b6ea79d959 | 3 | * @Post: no changes
* @Return: whether or not this point is under attack by an enemy king
*/
private boolean kingCanAttack(Point pointToCheck) {
// TODO Auto-generated method stub
King enemyKing;
if(isWhitesTurn())
{
enemyKing=myBoard.getBlackKing();
}else
{
enemyKing=myBoard.getWhiteKing();
}
... |
d6125fec-c5b8-4a89-95e6-3c7baa514e4e | 6 | static int fseek(InputStream fis, long off, int whence){
if(fis instanceof SeekableInputStream){
SeekableInputStream sis=(SeekableInputStream)fis;
try{
if(whence==SEEK_SET){
sis.seek(off);
}
else if(whence==SEEK_END){
sis.seek(sis.getLength()-off);
}
... |
c1d9a600-3b3b-4e0d-b9a0-33580e8af75d | 7 | public Shapes parseTextBlocks(InputStream source) {
// great a parser to get tokens for stream
Parser parser = new Parser(source);
Shapes shapes = new Shapes();
if (graphicState == null) {
graphicState = new GraphicsState(shapes);
}
// long startTime = Syste... |
455a9692-93e1-4953-aa9e-cecce1d12707 | 9 | final public String table() throws ParseException {
/*@bgen(jjtree) TAB */
SimpleNode jjtn000 = new SimpleNode(JJTTAB);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t; String tab; String s;
try {
t = jj_consume_token(WORD);
tab = ""; tab += t.image.toString() + "(";
jj_consume_tok... |
ed2770a1-b3d5-4871-ab4d-dfab8f9fc1c6 | 0 | public JPanel getPaneGraf(){
p = new JPanel();
p.add(getChartPanel());
return p;
} |
e2496adf-f48e-4921-a14c-24b6d6f8726f | 1 | public static String toSignature(List<String> stereotypes) {
StringBuilder builder = new StringBuilder();
for(String stereotype: stereotypes) {
builder.append("<<").append(stereotype).append(">>");
}
return builder.toString();
} |
fdfcd7f4-f2ba-4395-a24c-222cd36a8037 | 9 | public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
MapleCharacter pl = c.getPlayer();
if (splitted[0].equals("whosthere")) {
MessageCallback callback = new ServernoticeMapleClientMessageCallback(c);
StringBuilder builder = new StringBuild... |
3a017d30-723e-487a-81a4-c833f31565cd | 1 | public DataStructures getData(int index){
if(arraysBase != null)
return arraysBase.get(index);
else
return null;
} |
d687815a-753c-44e2-82fe-47a13890fd7d | 0 | public String getNilai() {
return nilai;
} |
139cbfef-38c4-4bac-8673-f76adbde3877 | 7 | String parseTokenChecked(String str, int ichStart, int ichMax) {
int ich = ichStart;
char ch;
while (ich < ichMax && ((ch = str.charAt(ich)) == ' ' || ch == '\t'))
++ich;
int ichNonWhite = ich;
while (ich < ichMax && ((ch = str.charAt(ich)) != ' ' && ch != '\t'))
++ich;
ichNextParse = ich;
if (ichNo... |
4dfc3551-fcb5-4390-a46d-9363ba49f382 | 8 | @Override
public void actionPerformed(ActionEvent event)
{
String actionCommand = event.getActionCommand();
if (actionCommand == ChessGameView.NEW_GAME_MENU_ITEM) {
setupNewChessGame();
} else if (actionCommand == ChessGameView.CLOSE_MENU_ITEM) {
System.exit(0);
... |
94ca32ca-2154-4028-9306-3876715980cd | 4 | @Override
public Object solve() {
int palindrome = 0;
for (int i = 999; i >= 100; i--) {
for (int j = i; j >= 100; j--) { //j = i to avoid repetition.
int k = i * j;
if (Strings.isPalindrome(k) && k > palindrome) {
palindrome = k;
... |
f116a460-506a-4ae3-8b66-6f181ea85e2c | 3 | private void initAirfieldList() {
try{
RecentLaunchSelections recent = RecentLaunchSelections.getRecentLaunchSelections();
airfields = DatabaseUtilities.DatabaseDataObjectUtilities.getAirfields();
List<Airfield> recentAirfields = recent.getRecentAirfield();
for (i... |
bdafa34e-d6de-4241-8873-e855db4c8eb9 | 8 | public boolean canMoveDown(PaletteEntry entry) {
PaletteContainer parent = entry.getParent();
int parentPermission = parent.getUserModificationPermission();
if (parentPermission < PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
return false;
}
if (parent.getChildren().indexOf(entry) + 1 != parent.getChild... |
e7188a7d-0259-4868-bc72-cb11e548de83 | 7 | public void checkEnemyAttackCollision(){
for(Character c1 : characters){
if(c1 instanceof EnemyCharacter){
EnemyCharacter enemy = (EnemyCharacter) c1;
if(c1.isAttacking()){
Ellipse2D.Double attackArea = null;
if(enemy.getDirection() == "up"){
attackArea = new Ellipse2D.Double(
... |
b4a45f15-4eef-4834-8486-8eefed73c3a7 | 4 | @Override
public void render(Graphics g) {
move();
g.setColor(Color.ORANGE);
g.fillRect(x, y, 50, 50);
if (direction == 1)
g.drawImage(up[step], x, y, 50, 50, null);
if (direction == 2)
g.drawImage(right[step], x, y, 50, 50, null);
if (direction == 3)
g.drawImage(down[step], x, y, 50, 50, null);
... |
24444ca7-a701-4029-8ab9-d403cc0c4bc9 | 0 | private static void printDetails() {
System.out.println("HASM v1.0"); // Version information
System.out.println("");
System.out.println("hasm [options] source"); // Input schema
System.out.println("");
System.out.println("-raw : Does not output the iNES header");
System.out.println("-? : Displa... |
c4634cfd-50ad-4f5a-a508-bee7b0f4167d | 4 | private static int getBestInt(int n) {
Random rand = new Random();
Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
for(int i = 0; i < n; ++i) {
int r = rand.nextInt(RIGHT_MERGE);
Integer freq = map.get(r);
map.put(r, freq == null ? 1 : freq + 1);... |
5ef78195-b199-406a-8d51-d68e946afebe | 9 | public boolean fetchAll(InputStream is) throws IOException {
//Decoder dec = new Decoder(sr,0,msglen);
while(true) {
int asrlen = objectLen();
if(DEBUG)System.out.println("Object size="+asrlen+"; Buffer size="+data.length+"; Current size="+length);
if((asrlen>0) && (asrlen>data.length)){
System.out.pri... |
61d04a89-d975-4fa1-8f7c-426c555d51ee | 0 | @Test
public void testTruncate_longWord()
{
String s = "Just give up and break significantly long words.";
Assert.assertEquals(
"Just give up and break significan…",
_helper.truncate(s, 34)
);
} |
0815ecf7-d098-4817-be9d-c9894f77016d | 2 | static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} |
b995060f-f2e9-4c3b-a9e2-a49d5c85fbe7 | 2 | public Borel(double mu) throws ParameterException {
if (mu < 0 || mu > 1) {
throw new ParameterException("Borel parameter 0 <= mu <= 1");
} else {
this.mu = mu;
}
} |
55c49572-231e-4a22-90dd-1a65721d8999 | 0 | public Calculator(String name) {
this.name = name;
this.allThroughTime = 0;
this.startTime = Calendar.getInstance().getTimeInMillis();
this.stopTime = 0;
} |
57b9fc5a-9cfb-48bc-9d13-2a9eb9f29e4e | 0 | public static void main(String[] args) {
new Camera();
} |
efcbf10c-842a-4dc1-9397-613b65527e29 | 6 | private boolean waitDOreply(int i) {
switch (i) {
case SUPGA:
return WAIT_DO_REPLY_SUPGA;
case ECHO:
return WAIT_DO_REPLY_ECHO;
case NAWS:
return WAIT_DO_REPLY_NAWS;
case TTYPE:
... |
2801dbb3-6b4e-49f0-8709-3854cfbc7629 | 3 | public GamePanel() {
setBorder(null);
Dimension size = new Dimension(WIDTH * 2, HEIGHT * 2);
setPreferredSize(size);
setFocusable(true);
requestFocus();
addKeyListener(this);
image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
graphics = (Graphics2D) image.getGraphics();
stageManager... |
2bb22dd0-6324-4e24-afb0-0c5d9327724e | 8 | @Test
public void testArithmetic() {
final Action<Pair<Character, Integer>, Integer> unary_to_int = new Action<Pair<Character, Integer>, Integer>() {
@Override
public Integer run(Pair<Character, Integer> p) {
if (p.getFirst() == '-') {
return -p.getSecond();
} else {
... |
92290551-194d-4e2b-85cb-917db0aa1a88 | 5 | public void print(int indent)
{
if (indent < 0) {
System.out.println("Cannot print array with a negative indent");
return;
}
Iterator<String> it = data.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
List<KVElement> values = data.get(key);
Iterator<KVElement> valuesIte... |
d1444d5d-79db-4985-9801-da9ae8d518b2 | 5 | @Override
public void update() {
if (KeyHandler.isPressed(KeyHandler.ENTER)) {
select();
}
if (KeyHandler.isPressed(KeyHandler.UP)) {
currentChoice--;
if (currentChoice == -1) {
currentChoice = options.length - 1;
}
}
if (KeyHandler.isPressed(KeyHandler.DOWN)) {
currentChoice++;
if (cu... |
d2ddcf72-cf31-4c06-9b3f-f2da26597bbc | 1 | @Override
public void setState(int state) {
super.setState(state);
if(state == ENABLED) {
textColor = "white";
} else {
flash = 0;
textColor = "gray";
}
} |
24860896-4dfd-418c-8a00-132bd2d16a79 | 7 | public void launcher() throws Exception {
this.outputs = new ArrayList<Long>();
this.outputs.add((long) 0);
this.outputs.add((long) 0);
this.outputs.add((long) 0);
//prepare ArrayList
List<Integer> USERS_IDS = new ArrayList<Integer>();
List<Item> U1_ORIGINAL_ARRAY = new ArrayList<Item>();
List<Item>... |
f069fea6-b561-44fe-bce9-c3536b228c44 | 7 | protected void loop() {
boolean looping=true;
while(looping) {
int c=Util.keyPress(String.format("[1] send [2] num_msgs (%d) [3] senders (%d)\n" +
"[d] details (%b) [x] exit\n",
num_msgs, num_sender... |
ad3ffd30-4b47-4d55-a3ca-950dbc17a79b | 5 | public static void calculateWinError(){
//output error
for(int outNode = 0; outNode < numOutputs; outNode++){
double sum = 0;
for(int weight = 0; weight < hidOut.length; weight++){
sum += (hiddenOutput[weight] * hidOut[weight][outNode]);
}
outputError[outNode] = derivitiveActivationFunction(sum) * (... |
653136de-ae88-4c4f-92d7-60ca6cbf5b99 | 7 | public void stop() throws UnsupportedOperationException {
if (!canBeStopped()) {
throw new UnsupportedOperationException("Stop not supported");
}
boolean joinit = false;
synchronized (lock) {
if (thread != null && !stopped) {
stopped = true;
if (paused) {
resume();
}
notifyExecutionSt... |
a9160490-3d21-4f32-a6d1-828e4d30bd6e | 7 | private Szo igeragozastVegignez(Mondat mondat, List<Szo> potencialisSzavak) {
Szo ret = null;
for (Szo szo : potencialisSzavak) {
for (String mondatSzava : mondat.getVizsgalandoSzavak()) {
for (SzamSzemely szamSzemely : SzamSzemely.values()) {
for(Mod mod ... |
713d15f4-8270-45e5-af94-876b7f2e5795 | 0 | public byte[] receive() {
inputAvailable.acquireUninterruptibly();
return inputBuffer.pop();
} |
3f72e3d8-fc13-4fe9-9520-4a43c9c9b73f | 4 | public static Type parse(String signature)
{
int end = 1;
while(true)
{
char c = signature.charAt(end);
if(c == ' ' || c == '(')
break;
end++;
if(end == signature.length())
break;
}
return Type.valueOf(signature.substring(1, end).toUpperCase());
} |
9cdfae60-bf15-48de-b9cc-fcf56af03531 | 5 | void placeBlockLine(int[] var1, int[] var2, int var3) {
int[] var4 = new int[]{0, 0, 0};
byte var5 = 0;
byte var6;
for(var6 = 0; var5 < 3; ++var5) {
var4[var5] = var2[var5] - var1[var5];
if(Math.abs(var4[var5]) > Math.abs(var4[var6])) {
var6 = var5;
}
... |
e205f518-a719-4086-9b02-3a0fb0b400f7 | 3 | public static boolean hasRevisiondesc (String eadfile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError{
boolean result = false;
FileInputStream fileInputStreamEAD = new FileInputStream(eadfile);
XMLEventReader xmlEventReaderEAD = XMLInputFactory.newInstance()
.createXMLEventRea... |
aabae8d6-75e6-4240-9cbd-cefa2c8fa53b | 9 | private double offset(String s) {
if(getLoc().nextTile != null) {
if (getLoc().getCoordinates().x - getLoc().nextTile.getCoordinates().x < 0
&& s.equals("x"))
return pixels;
else if (getLoc().getCoordinates().x
- getLoc().nextTile.getCoordinates().x > 0
&& s.equals("x"))
return -pixels;
else i... |
17c04296-b15c-4a74-a7fd-7fbabe835cb3 | 2 | public static <T> T request(String url, ResponseHandler<T> responseHandler) {
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpget = new HttpGet(url);
CloseableHttpResponse response = httpClient.execute(httpget);
return responseHandler.handle(response.getEntity()
... |
08c5b687-3fbc-4eff-95c4-795e5fe5b79a | 6 | public static int[] lcp(int[] sa) {
int n = sa.length;
int[] rank = new int[n];
for (int i = 0; i < n; i++)
rank[sa[i]] = i;
int[] lcp = new int[n - 1];
for (int i = 0, h = 0; i < n; i++) {
if (rank[i] < n - 1) {
for (int j = sa[rank[i] + 1]; Math.max(i, j) + h < cad.length
&& cad[i + h] == ca... |
f6fd0290-30b4-4e15-9426-d8c76252e1b1 | 4 | private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
/*
* Método que hace visible los campos necesarios para realizar la busqueda de los datos, según los
* requerimientos para cada informe al seleccionar cada opcion del ComboBox
... |
f74c3d04-0284-4709-a76c-820b520db577 | 9 | @Override
public void run() {
// Check for valid local and remote port, hostname not null
log.debug("Checking Proxy: port '%s' to '%s' port '%s'", localPort, remoteHost, remotePort);
// Input data validation
if (localPort <= 0) {
throw new ProxyException("Error: invalid ... |
07b2707b-561b-46d5-af7d-82f9d63a9243 | 8 | private void placeLightGrenadeNearPlayer() {
for (Player p : grid.getAllPlayersOnGrid()) {
boolean placed = false;
Position pos = grid.getElementPosition(p);
int minX = (pos.xCoordinate > 1) ? pos.xCoordinate - 4 : 0;
int maxX = (grid.width - pos.xCoordinate > 1) ? pos.xCoordinate + 4 : grid.width;
in... |
177772ec-f945-4a8f-991a-5b275d7109b0 | 9 | public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: ");
System.out.println(" TTFTest <input file> <output file>");
System.exit(-1);
}
try {
RandomAccessFile raf = new RandomAccessFile(args[0], "r");
int size = (int) raf.length();
... |
ecda0b85-8253-4120-aacb-5566235fa4b2 | 0 | public int GetVerticalBuses()
{
return VERTICALBUSES;
} |
8496ff38-c1e9-4122-8b60-72b8bead4c27 | 7 | public static void main(String[] args) {
Map<String, Object> darbai = new HashMap<String, Object>();
darbai.put("suprojektuoti siena", 4f);
darbai.put("maisyti glaista", 6f);
darbai.put("muryti sienas", 12f);
darbai.put("pasluoti", 2f);
darbai.put("rinkti siuksles", 2f);
D... |
bf42dfec-9704-4b35-a0ea-d16eb0a941d7 | 3 | @Override
public Boolean playGame(ChoiceCode choiceCode) {
user.setCurrentChoice(ChoiceFactory.createPlayerChoiceFromCode(choiceCode));
computer.setCurrentChoice(ChoiceFactory.randomChoice());
try {
lastGameWinner = currentMatch.playGame();
} catch (MissingPlayers e) {
e.printStackTrace();
} catch (Mat... |
9917f41b-f53f-477c-bc22-5d4af6cd83e7 | 8 | public void setPopupMenuVisible(boolean b) {
if (!b) {
super.setPopupMenuVisible(b);
return;
}
boolean isVisible = isPopupMenuVisible();
if (isVisible)
return;
if (fPopupMenu == null) {
fPopupMenu = getPopupMenu();
fPopupMenuSize = fPopupMenu.getPreferredSize();
}
if (isShowing... |
1e1897a1-3a07-4d4f-bf4f-709691aa1ba4 | 7 | public void paintObject() {
int color = Color.lightGray.getRGB();
for( int iy = 0; iy < myHeight; iy++ ) {
int indexRow = iy*myWidth;
for( int ix = 0; ix < myWidth; ix++ ) {
myScreenBuffer[ix+indexRow] = color;
}
}
if( myMousePos.x >= 0 && myMousePos.y >= 0 ) {
int color1 = Color.black.getRGB()... |
f5d67af5-8bb9-45c1-9683-821e74b5d5d6 | 2 | public boolean addStock(Stock s) {
if (s == null) {
return false;
}
Element e = getStockByIdentifier(s.getIdentifier());
if (e != null) {
System.err.println("Stock " + s.getIdentifier() + " already exist!");
return false;
}
Ele... |
d8f88434-4453-427e-9442-5b5c3b307603 | 4 | public static void main(String[] args) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to... |
c692eaea-b7b6-4dac-b24f-9506bef7c58c | 3 | public Boolean ReserverArticle(String ISBN, String membreLogin, Date dateReservation){
// Trouver le membre et l'article
BiArticles article = this.GetArticleByID(ISBN);
BiMembres membre = this.GetMembreByUsername(membreLogin);
BiReservationsId resId = new BiReservations... |
af409206-8290-4780-8d69-ba5e1a9311a6 | 8 | @Override
public boolean equals(Object item) {
Item itemToCompare = (Item) item;
if((this.name == null && itemToCompare.getName() == null) || (this.name != null && this.name.equals(itemToCompare.getName())))
if((this.id == null && itemToCompare.getId() == null) || (this.id != null && this.id.equals(itemToCompa... |
1df7738c-18fb-43ab-b4a5-ce2d22393a56 | 4 | public boolean canPlace() {
if (! super.canPlace()) return false ;
for (Tile t : Spacing.perimeter(area(), origin().world)) if (t != null) {
if (t.owningType() >= this.owningType()) return false ;
}
return true ;
} |
bdf6d6d0-1fa0-4c87-8e98-117f0d452402 | 7 | public void action(ChatPlayer player, String line, String channel) {
ChatChannel chan = ChannelManager.getChannel(PlayerManager.getPlayer(player).channel);
if (channel == null || channel.length() <= 0)
channel = chan.name;
else
chan = ChannelManager.getChannel(channel);
if (MCNSAChat3.permissions.getUser... |
28643c2c-4f65-4479-81d1-95848b33625e | 5 | public void testisEmptyLeafCard() throws Exception {
for (int i = 0; i < 100; i++) {
RBtree empt = empty();
if ((!empt.isEmpty()) && (empt.cardinality() == 0)) {
throw new Exception("A NON-EMPTY TREE HAS ZERO CARDINALITY");
}
if(empt.isEmpty() && (empt.cardinality() != 0)) {
throw new Exception... |
61294511-3c52-401c-af18-b27577a889b7 | 0 | public String toString() {
return s + i;
} |
8659b847-474b-455e-a17d-6ba6d21577c1 | 0 | public AddressBook(List<String[]> addressBookData) {
data = addressBookData;
} |
b500b6b3-79e5-4a76-bf93-83f31e90d9a0 | 9 | private List<ClassDocImpl> getClasses(boolean filtered) {
if (allClasses != null && !filtered) {
return allClasses;
}
if (allClassesFiltered != null && filtered) {
return allClassesFiltered;
}
ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>... |
c8e0b5f5-ae01-45ec-b7f3-fddd12bf801d | 1 | public int hashCode() {
int code = super.hashCode();
for (int i = 0; i < myTapes.length; i++)
code = code ^ myTapes[i].hashCode();
return code;
} |
39f8d55e-9f71-4650-8679-fad32be2736c | 3 | public static void benchmarkByteLargeArrayNativeInANewThread()
{
System.out.println("Benchmarking ByteLargeArray native in a new thread.");
final long length = (long) Math.pow(2, 32);
long start = System.nanoTime();
final ByteLargeArray array = new ByteLargeArray(length);
Sys... |
0f309f42-c78c-4341-804d-0d3f95032a94 | 2 | @Override
public void stateChanged(ChangeEvent e) {
Object obj = e.getSource();
if (obj instanceof JTabbedPane) // tab clicked
{
JTabbedPane tab = (JTabbedPane) obj;
if (tab.getSelectedIndex() != 2)
return;
refreshContestantCBs();
return;
}
} |
da8158d3-27eb-4c43-89ce-e718ea2b07aa | 9 | public int synthesis(Packet op){
Info vi=vd.vi;
// first things first. Make sure decode is ready
// ripcord();
opb.readinit(op.packet_base, op.packet, op.bytes);
// Check the packet type
if(opb.read(1)!=0){
// Oops. This is not an audio data packet
return(-1);
}
// read... |
0c58eb78-eb37-4f24-9494-fc70b9671196 | 6 | @Override
public void act(XY xy) {
if (canShot(obj, xy, maxDistance)) {
MODEL.log("Выстрел по " + xy);
int distance = maxDistance;
XY shellPlace = obj.getXY().copy();
Direction direction = new Direction(this.obj.getXY(), xy);
while (true) {
... |
2c4106ed-167d-4a82-93cf-f2c15c6df310 | 6 | public void createWindowComponents(final Container con)
{
chessboardPanel = new JPanel();
chessboardPanel.setLayout(new GridLayout(8,8));
Color a = Color.LIGHT_GRAY;
Color b = Color.DARK_GRAY;
for(int i = 0; i < BOARD_LENGTH; i++)
{
for(int j = 0; j < BOARD_WIDTH; j++)
{
buttonBoard[i][j]... |
2c2d7d2a-0da3-4f71-b8ab-2be887055b9b | 3 | public boolean Check(String login, String password) {
try {
out = new PrintWriter(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out.println(login);
out.flush();
out.println(password);
out.flush();
j = Integer.parseInt(in.readLine());
switch... |
a0a9c61e-814b-4c19-aefa-753f582e6b6f | 5 | public void run() {
while (true) {
try{
addEmployee();
} catch (EndDataEntry e) {
break;
}
}
StringBuffer sbuf_begin_with_s;
sbuf_begin_with_s = new StringBuffer();
StringBuffer sbuf_even_id;
... |
af2b93db-884e-488e-88e6-c60465b50757 | 5 | @Override
public void mouseClicked(MouseEvent event) {
if (generalTab.isDrawOn()) {
int x = (event.getX() / Variables.POINT_SIZE);
int y = (event.getY() / Variables.POINT_SIZE);
if (x >= Variables.START_DISPLAY && x <= Variables.END_DISPLAY && y >= Variables.START_DISPLAY && y <= Variables.END_DISPLAY)... |
a14fc153-8a46-4512-99c7-4b5be1230590 | 3 | protected void sort(LinkedList<Student> visibleStudents) {
Comparator<Student> comparator;
if (this.nameSort.isSelected())
comparator = dec.isSelected() ? Comparators.pDec : Comparators.pInc;
else
comparator = dec.isSelected() ? Comparators.nDec : Comparators.nInc;
Collections.sort(visibleStudents, compar... |
789543da-b70e-42bd-9300-ad764062eb9e | 5 | protected void paintBackground(Graphics g) {
g.setColor(getComponent().getBackground());
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
Boolean doShow = (Boolean) getComponent().getClientProperty("doShowFocusFrame");
if (doShow == null || doShow.booleanValue()) {
... |
9acb3324-9a25-4cc6-8eec-b0a5ebda6908 | 3 | public static void move() {
Event e;
while ((e = nextEvent()) != null) {
for (int i = 0; i < serviceList.size(); i++) {
if (serviceList.get(i).doEvent(e)) break;
}
}
} |
ea2a262a-fe6e-4474-9207-fcc659222b93 | 7 | private static int[] getColor() {
int[] color = { 0xFF111111, 0xFFD50000, 0xFFFFFFFF };
switch (random.nextInt(8)) {
case 0: {
// red color
color[1] = 0xFFD50000;
break;
}
case 1: {
// yellow color
color[1] = 0xFFFFF115;
break;
}
case 2: {
// blue color
color[1] = 0xFF6997FF;
b... |
6eb900da-e682-4f9b-9ad3-964da3900a1e | 3 | public SignatureVisitor visitArrayType() {
if (type != TYPE_SIGNATURE || state != EMPTY) {
throw new IllegalStateException();
}
state = SIMPLE_TYPE;
SignatureVisitor v = sv == null ? null : sv.visitArrayType();
return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
... |
2c1516b8-657c-43ed-ba6d-aa34edb945aa | 3 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
dbg("GraphPoint.paintComponent");
Graphics2D g2d = (Graphics2D)g;
int rad = getSelect() ? CIRCLE_RAD_SELECT : CIRCLE_RAD_NOSELECT;
int radbor = getSelect() ? CIRCLE_BORDER_RAD_SELECT : CIRCLE_B... |
280a7150-4b2c-4027-a9ac-e605a66c3a5a | 0 | public long getBulletTimer(){
return this.bulletTimer;
} |
44fcc8e7-9a0b-40b2-958c-7c7f0798b8d4 | 4 | public void performMethod() {
readSelection();
try{
DistributionModel distribution = Model.getDistributionModelInstance(distributionSel);
distribution.setParamString(distributionParamDefString);
distribution.setNumberOfNodes(numberOfNodes);
distribution.initialize();
addedNodes = new Vector<Node>... |
032ab84c-7157-4d26-83d1-678f90170a69 | 7 | public void changeLoc(int newLocX, int newLocY)
{
if (privs>1 || (batBattle == null && !blnSleep && engGame.canMoveTo(newLocX,newLocY,this)))
{
if (isMob())
{
if (!(Math.abs(originalX-newLocX) < engGame.viewrange && Math.abs(originalY-newLocY) < engGame.viewrange))
{
return;
}
}
chang... |
04d6de71-710a-4445-b753-250ba9604e4d | 2 | public void add(String message){
if (length < 10){
messages[length] = message;
length++;
} else {
for (int i = 0; i < 9; i++){
messages[i] = messages[i+1];
messages[9] = message;
}
}
} |
45bad42d-a4a4-46c0-bad0-fda90d860bc5 | 9 | static void process(int[] mas, int div, StringBuilder res) {
if (div >= 0) {
if (mas[3 * div] != 0 || mas[3 * div + 1] != 0 || mas[3 * div + 2] != 0) { //check that div has some value
if (res.length() > 0) {
res.append(" ");
}
String strHund = showHundreds(mas, div);
res.append(strHun... |
fc63d0db-9d09-43ac-a455-c15ba8a99b29 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
d5acd57e-c063-41bc-a13c-53ab575221a7 | 3 | public boolean remove(int target)
{
int index;// the location of target in the data array;
boolean success = false;//added by me;
for(index = 0; (index < manyItems)&&(target != data[index]); index++);
//No work is needed in the body of this for-loop
System.out.print("manyItems = ");
System.out.print(manyIt... |
4a74ef8f-a053-41d0-9a59-a0a8468cec26 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
... |
9435c5e5-f622-423e-950b-1643c4949d46 | 4 | public static byte[] exec(final String cmd, final String[] args,
final byte[] in, final File dir) throws IOException,
InterruptedException {
final StringBuilder sb = new StringBuilder();
if (cmd.contains(" ")) {
sb.append('"' + cmd + '"');
} else {
sb.append(cmd);
}
for (fin... |
390c10f1-5b32-41ee-8c82-826348483aba | 4 | private void analyse(DatagramPacket packet) {
String data = new String(packet.getData()).trim();
if (data.startsWith("/c/")) {
clients.add(new Client(packet.getAddress(), packet.getPort(), data.replace("/c/", "")));
sendMessageToAll("User " + data.replace("/c/", "") + " has conne... |
ec8f6206-5e72-462a-8f2b-39f2d1bc871e | 0 | public String getBlogContent() {
return blogContent;
} |
ae6585ac-3bf5-4ae0-a18e-e317c8111c29 | 7 | @Override
public String toString() {
String value = String.format("%.2f", this.value);
String appendix = " - ";
String unit = "";
switch (type) {
case USER_SESSIONTIME_MIN:
appendix += "minimum session time";
unit = "s";
break;
case USER_SESSIONTIME_MAX:
appendix += "maximum session time";
... |
fc1b4fa9-663e-45a4-b6ac-3e720d259be2 | 2 | public void set_pwm_v(short value) throws IOException {
byte[] data=new byte[3];
data[0]=(byte)SET_PWM_V;
data=_shortToByteArray(data,value,1);
byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1);
if (result.length==0) throw new IOException("no answer from device");
if (result[... |
3bd3b9af-3fda-419d-b165-d65bfb75e7d3 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CarType other = (CarType) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return fals... |
462f3189-a5db-4f06-857b-010db4ea3990 | 3 | public void setValue(Map values,JTable accountTable){
clearValue();
System.out.println("values.size():"+values.size());
Set set = values.keySet();
Iterator iterator = set.iterator();
int i=0;
data = new Object[values.size()][];
while(iterator.hasNext()){
Stri... |
7a1fb46c-c95f-45e9-ae61-09babef12706 | 8 | private static void playerXZMovements() {
Player player = PlayerManager.PLAYER;
float yawRadians = (float) Math.toRadians(player.getAng().y);
float originalSpeedSquaredXZ = new Vector3f(player.getVel().x, 0, player.getVel().z).lengthSquared();
Vector3f appliedForce = new Vector3f();
... |
c40372d8-b10b-4b28-b42f-2d791cbb2ab5 | 5 | public int lengthOfLongestSubstring(String s) {
int max = 0;
int count = 0;
Queue<Character> subString = new LinkedList<Character>();
char[] theString = s.toCharArray();
for (int i = 0; i < theString.length; i++) {
Character thisChar = theString[i];
if (su... |
cc357370-c182-4ada-9d48-ce6781b0ad13 | 7 | public void rotarAtras() {
if (direccion.equals(Direccion.derecha)) {
rotar(tipoTrans.enZ, -90);
} else if (direccion.equals(Direccion.izquierda)) {
rotar(tipoTrans.enZ, 90);
} else if (direccion.equals(Direccion.adelante)) {
rotar(tipoTrans.enZ, 180);
... |
f31f5a28-a6d4-45e6-b9c1-ae8f44ca4375 | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_FilterEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst = n... |
b1eb3fc3-2c7b-4317-9c19-ada5f14d7c13 | 9 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
String inputUsuario = jTextField1.getText();
int cantidadPartidasGuardadas = jugadorPrincipalPrograma.getPartidasDelJugador().size();
if(!(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.