method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cf4efa55-2536-4abe-b374-ed04cc98dcf5 | 2 | public boolean startTurn(int day)
{
Iterator<Castle> i = castles.iterator();
while (i.hasNext()) {
Castle c = i.next();
if (c.getColor() != color) {
i.remove();
}
}
return false;
} |
af17cacb-0fbb-4145-8cc0-576e54613fd9 | 6 | public EasyDate endOf(int field) {
switch (field) {
case Calendar.YEAR:
calendar.set(Calendar.MONTH, 11);
case Calendar.MONTH:
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
case Calendar.DAY_OF_MONTH:
calendar.set(Calendar.HOUR_OF_DAY, 23);
case Calendar.HOUR_... |
e291c900-de25-41a9-9bd3-5ad4c3398ad5 | 4 | public static void main(String[] args){
String kod = null;
int[][] tabla = new int[8][3];
sc = new Scanner( System.in );
while( true )
{
System.out.println("Játék indítasa : 1");
System.out.println("Játék szabály : 2");
System.out.println("Kilépés : 3");
logger.info( "Játék indul, választás ... |
aec373e7-63f6-4324-89cf-87a594e7e324 | 2 | @Override
public boolean accept(File dir, String name) {
try{
if (name.substring(name.lastIndexOf(".")).equalsIgnoreCase(".dat"))
return true;
}
catch (Exception e){
System.err.println("Exception caught: " + e);
}
return false;
} |
96835aa6-aea6-43f1-8005-23b987e5d712 | 4 | public void close(){
try{
if(in!=null)in.close();
if(out!=null)out.close();
if(socket!=null)socket.close();
}
catch(Exception e){
}
in=null;
out=null;
socket=null;
} |
5da01ecf-04ba-4f01-a64a-02081127317c | 5 | private static void updateTexturePacks () {
for (int i = 0; i < texturePackPanels.size(); i++) {
if (selectedTexturePack == i) {
String packs = "";
if (TexturePack.getTexturePack(getIndex()).getCompatible() != null) {
packs += "<p>This texture pack... |
faf8084a-8e52-43b2-aaf9-0c1524d0fec1 | 4 | private boolean suitMoveIsValid(Card.Suit from, Card.Suit to) {
switch (to) {
case HEARTS:
return from != Card.Suit.DIAMONDS;
case DIAMONDS:
return from != Card.Suit.HEARTS;
case CLUBS:
return from != Card.Suit.SPADES;
... |
22e2ef95-299f-4072-b612-2fd2e0a453da | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equalsIgnoreCase("killall")){
if(sender instanceof Player){
Player p = (Player) sender;
if(p.isOp() || p.hasPermission("scmds.killall")){
for(Entity entity : p.getNearbyEntities(2000,... |
7de1edfb-53a2-4e66-bdf3-89aca057da79 | 1 | private void check (int [ ] array1, int [ ] array2) {
assertTrue (array1.length == array2.length);
for (int k=0; k<array1.length; k++) {
assertTrue (array1[k] == array2[k]);
}
} |
25d8c01d-5678-48ed-9b93-32eba3568c69 | 1 | public void deleteActor(long id) {
if(actors.get(id) != null) {
actors.get(id).destroy();
actors.remove(id);
}
} |
99c3713b-e53b-4bc0-b6b9-fd63ab7999fc | 2 | protected JComponent makeTextPanel(String text) {
JPanel panel;
if(text.equals("Open tickets")){
panel = new TicketOverview();
}
else if(text.equals("Solutions")){
//panel = new QAThesaurusView();
panel = new JPanel(false);
JLabel filler = new JLabel(text);
... |
29638da9-163b-4ff5-9e34-f13c2076b43c | 1 | public static void main( String[] args ) throws IOException {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setBounds( 20, 20, 800, 600 );
final UmlDiagramRepository repository = UmlDiagramRepository.createDefaultRepository();
repository.getConfiguration().getCo... |
d4de22eb-90f3-4205-b9da-7519ffcefaa8 | 1 | public Dimension getPreferredSize() {
if (image != null) {
return new Dimension(image.getWidth(), image.getHeight());
}
return super.getPreferredSize();
} |
75adec86-75bc-41d1-bbd3-b5ab85043bbd | 3 | public void getStarGraph(mxAnalysisGraph aGraph, int numVertices)
{
if (numVertices < 4)
{
throw new IllegalArgumentException();
}
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
for (int i = 0; i < numVertices; i++)
{
... |
a8cceccd-1ecc-4140-8a4f-442eb20e61fe | 0 | public double magnitudeSquared()
{
double doubleA = a.doubleValue();
double doubleB = b.doubleValue();
return doubleA * doubleA + doubleB * doubleB;
} |
9f7bd25e-8d70-48ab-9145-19533cb37238 | 7 | public List<Token> tokenize(final InputStream stream) throws IOException {
LineColumnReader reader = new LineColumnReader(new InputStreamReader(stream));
List<Token> tokens = new LinkedList<Token>();
try {
while (reader.ready()) {
int c = reader.read();
if (Character.isWhitespace(c)) {
... |
6c5a0dae-a035-4720-925b-0b5a377954e7 | 1 | public void testConstructorEx5_TypeArray_intArray() throws Throwable {
try {
new Partial(new DateTimeFieldType[] {DateTimeFieldType.dayOfYear()}, new int[2]);
fail();
} catch (IllegalArgumentException ex) {
assertMessageContains(ex, "same length");
}
} |
058a1177-8845-4e7b-9a3e-0b2b5fe18d81 | 9 | private void readPinNames(HDLTokenizer input, int partNumber, String partName)
throws HDLException {
boolean endOfPins = false;
// read pin names
while (!endOfPins) {
// read left pin name
input.advance();
if (!(input.getTokenType() == HDLTokenizer.TYPE_... |
315db7a4-c59b-476b-8b1a-0601c5ddb684 | 4 | protected static void exportOutlinerDocument(OutlinerDocument document, FileProtocol protocol) {
// We need to swap in a new documentSettings object so that the changes don't carry over
// to the open document, but are conveyed to the export. We'll put the real object back
// when we're done.
DocumentSettings o... |
4e77176c-7e92-4014-8e3c-a74ba55fd6a7 | 7 | public LinkedList<FaultsStore> getFaults(){
LinkedList<FaultsStore> psl = new LinkedList<FaultsStore>();
Connection Conn;
FaultsStore ps = null;
ResultSet rs = null;
try {
Conn = _ds.getConnection();
} catch (Exception et) {
System.out.println("No Connection in Faults Model");
return null;
}
... |
e45f36d3-2d2f-4196-96c8-3b8c3a6ab75c | 3 | public void update(){
if(active){
curTime++;
if(curTime>duration){
active = false;
curTime = 0;
curCooldown = cooldown;
}
}
if(curCooldown>0){
curCooldown--;
}
} |
1fe6bc68-3979-43ec-80ac-4cb52c8e917d | 4 | public Object parseValue(String value) throws NumberFormatException, ParseException {
switch(type){
case("int"): return Integer.valueOf(value);
case("string"): return value;
case("float"): return Float.valueOf(value);
case("date"): return dateFormatter.parse(value);
default: return null;
}
} |
98e318ef-0b81-44cd-9308-6d7d99e1008e | 3 | public void connect() {
if (connection != null) {
throw new IllegalStateException("Already connected!");
}
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://" + host + "/" + database
+ "?useUnicode=true&characterEncoding=utf-8", user, password);
... |
c3d9dc82-63f4-436c-bbca-a0af5ff745c4 | 9 | @Override
public void run() {
while (true) {
Packet packet = null;
try {
packet = queue.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
if ( packet.isFormat() ) {
while (queue.size() < 100 )
try {
Thread.sleep(1);
} catch (InterruptedException e) {
... |
2402e81d-9ab8-4e30-9bad-d66a5cf66fc6 | 4 | @Override
public double evaluate(int[][] board) {
int r = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (board[i][j] != 0) {
if (blocked(i, j, board)) {
r++;
}
... |
306990b2-a9d7-4234-9265-33a1f94583e9 | 0 | public YamlPermissionBase(String n, ConfigurationSection config) {
name = n;
yamlConfiguration = config;
} |
8210213b-cae7-4635-8073-741673ad1d06 | 5 | private void send() {
int maxAttemps = 5, cnt = 0;
while (cnt < maxAttemps) {
Node nextNode = null;
boolean initiator = false;
try {
nextNode = RoutingManager.nextNode(packet);
if (isNodeInitiator(nextNode)) {
initi... |
a92ce426-9074-4fdd-8579-ed1903721abd | 5 | public static ContactLocation convertLocationToType(String loc)
{
if (loc.equalsIgnoreCase("DC")) return ContactLocation.DIALLED_CALLS;
else if (loc.equalsIgnoreCase("MC")) return ContactLocation.MISSED_CALLS;
else if (loc.equalsIgnoreCase("ME")) return ContactLocation.PHONE_ENTRIES;
else if (loc.equalsIgnoreC... |
53b3046f-084c-4c20-817d-fc8b3e5352dc | 5 | public static String toCamel(final String... string) {
StringBuilder builder = new StringBuilder(100);
if ((string != null) && (string.length > 0)) {
for (int i = 0; i < string.length; i++) {
String part = string[i];
if (!isEmpty(part)) {
part = part.trim().toLowerCase();
builder.append(part.su... |
fb1d5791-b012-4763-b497-2da4a4a6943c | 6 | final NPCComposite method1149() {
int j = -1;
if (anInt2099 == -1) {
if (anInt2077 != -1) {
j = Class21.settings[anInt2077];
}
} else {
j = Class142_Sub27_Sub14.method1892(anInt2099);
}
if (~j > -1 || j >= -1 + anIntArray2085.le... |
27da3d75-7f62-4dc4-b539-6ab548ab203b | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i ... |
1462bcfc-d7cf-4b33-992f-8d6196b15743 | 1 | public void testConstructor_ObjectStringEx4() throws Throwable {
try {
new TimeOfDay("1970-04-06T10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {}
} |
421495be-5fcb-41bd-a50f-aff935a1678c | 6 | public void fusionWithDarkenFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha1 =... |
60b9b10e-a1ca-40ea-a8e3-9e752f23e340 | 3 | private void btnImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirActionPerformed
// Codigo de imprimir
int a = panelGeneral.getSelectedIndex();
Imprimir imp;
try {
if (a == 0) {
imp = new Imprimir(this);
} else ... |
e7928744-da83-4017-b3bb-e82d941a3cc2 | 0 | @Override
public int getBrewButtonStatus() {
return brewButtonStatus;
} |
6546fdec-f21e-4087-80e3-388f3702d91f | 0 | public void setPrice(String price) {
this.price = price;
} |
e26ed893-09fa-4d4f-9eb0-66f58fc5966b | 1 | public static void main(String[] args) {
// Methods in Comparator
List<Person> people = new ArrayList<>();
people.sort(
Comparator.comparing(Person::getLastName)
.thenComparing(Person::getFirstName)
.thenComparing(
... |
6f2b0342-42cb-4029-a0e2-ed661b1f3b92 | 3 | public void insert_aswrange(final Swizzler indswz) {
final Iterator iter = CFG.preds(indswz.phi_block()).iterator();
while (iter.hasNext()) {
final Block blk = (Block) iter.next();
if (!indswz.phi_block().dominates(blk)) {
final SRStmt aswrange = new SRStmt((Expr) indswz.array()
.clone(), (Expr) ind... |
f89ec65a-a3b0-4990-b8cd-b149dee27684 | 8 | private void render() {
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
Graphics2D g2d = (Graphics2D) g;
if (state == STATE.MENU) {
menu.render(... |
bd3c4b6e-12e0-4f73-9a65-5881626efe4e | 7 | void setLayoutData () {
Control [] children = layoutComposite.getChildren ();
TableItem [] items = table.getItems ();
GridData data;
int hSpan, vSpan, hIndent, vIndent;
String vAlign, hAlign, vGrab, hGrab, exclude;
for (int i = 0; i < children.length; i++) {
data = new GridData ();
/* Set widthHint an... |
517fb42b-04ab-47ca-b338-3055c824c116 | 4 | @Override
public List<Edge<N>> edgesFrom(N... fromList) {
LinkedList<Edge<N>> list = new LinkedList<Edge<N>>();
if(fromList.length == 1) {
N from = fromList[0];
if(containsNode(from)) {
list.addAll(nodes.get(from));
}
} else if(fromList.length > 1) {
for(int i = 0; i < fromList.length; i++) {
... |
16e19490-4032-4cd9-bf15-001497851e12 | 5 | public char read() throws IOException {
if (isPriorEndLine) {
lineno++;
position = -1;
nextLine = source.readLine();
if(nextLine!= null) sourceText.add(nextLine);
// debug statement
/*
if (nextLine != null) {
Sys... |
1dc7f086-8fdb-4012-883c-ec38f2bdee32 | 6 | public String getNewick(boolean bl) {
StringBuffer ret = new StringBuffer("");
for (int i = 0; i < this.getChildCount(); i++) {
if (i == 0) {
ret.append("(");
}
ret.append(this.getChild(i).getNewick(bl));
if (bl) {
double branchLength = this.getChild(i).getBL();
if (branchLength == 0)
... |
182d631e-7a4c-4495-a22e-2f95702f73a7 | 3 | public Builder mergeImage(protocols.ChatProtocol.Image value) {
if (imageBuilder_ == null) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
image_ != protocols.ChatProtocol.Image.getDefaultInstance()) {
image_ =
protocols.ChatProtocol.Image.newBuilder(image_).... |
7f105a2c-fa74-423e-b765-148d43f49494 | 2 | public final synchronized byte readByte(){
this.inputType = true;
String word="";
byte bb=0;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)bb = Byte.parseByte(word.trim());
return... |
7a01f696-6a93-4911-b5c6-27f055e5572c | 4 | @Override
public void sort(T[] a, int lo, int hi)
{ // Sort a[] into increasing order.
boolean sorted = false;
for (int i = lo ; i <= hi && !sorted; i++)
{// Bubble the i'th smallest element up if the array is still unsorted
sorted = true;
for (int j = hi ; j > i; j--)
if (less(a[j], a[j - 1])... |
938d972e-c9b0-414f-be36-4349a80cf901 | 1 | @Override
public void adjust() {
CloseHandler handler = getTarget(CloseHandler.class);
setEnabled(handler != null ? handler.mayAttemptClose() : false);
} |
670832ed-ccae-4eac-94d0-ef52267e4b4f | 7 | private List<List<String>> splice(String text) {
List<List<String>> lines = new ArrayList<List<String>>();
List<String> line = new ArrayList<String>();
int len = 0;
StringTokenizer st = new StringTokenizer(text, " ");
while (st.hasMoreTokens()) {
String word = st.nextToken();
if ((len... |
6892af07-7fd3-4d9c-bd46-2df2f48a6814 | 5 | private void addGuestToBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addGuestToBookingButtonActionPerformed
boolean addGuestSuccess;
Booking currentBooking = ctr.getCurrentBooking();
if (currentBooking != null && guestJList2.getSelectedValue() != null) {
... |
51870b90-9c22-43e7-8aca-ab24ac97be8e | 7 | public int getBid(Letter bidLetter, ArrayList<PlayerBids> playerBidList, ArrayList<String> playerList, SecretState secretState) {
// Keep track of how many players have exactly 6 letters
int sixLetterCount = 0;
// Defense factor is to prevent other players from bidding high
// but getting letters cheaply
... |
16d195cf-3a25-4a1d-abeb-44ff571c1eaf | 3 | public void init() {
// remplir une première fois la grille
while (game.fillGrid());
// enlever les alignements existants
while (removeAlignments()) {
while (game.fillGrid());
}
} |
1b68bf38-71f2-4276-9aa5-d2421af36fdf | 5 | private boolean isPlayerKingInCheckFromPieceHorizontallyLeft() {
for (int j=playerKingPiece.pieceColumn - 1; j>=1; j--){
BoardSquare boardSquare = chessBoard.getBoardSquare(playerKingPiece.pieceLine, j);
if (boardSquare.containsBoardPiece()){
if (j==playerKingPiece.pieceColumn-1){
if (boardSquare.conta... |
2c45e52d-4878-4c28-b53c-ca4c53a67a68 | 2 | private void deleteRequest(HttpExchange he) throws IOException {
try {
InputStreamReader isr = new InputStreamReader(he.getRequestBody(), "UTF-8");
BufferedReader br = new BufferedReader(isr);
String jsonInput = br.readLine();
String path = he.getRequestURI().get... |
e25faee9-57d0-4985-9b48-47831813dc18 | 2 | private void initKeys() {
inputManager.addMapping("down", new KeyTrigger(KeyInput.KEY_W));
inputManager.addMapping("up", new KeyTrigger(KeyInput.KEY_S));
inputManager.addMapping("left", new KeyTrigger(KeyInput.KEY_A));
inputManager.addMapping("right", new KeyTrigger(KeyInput.KEY_D));
inputManager.addMapping(... |
8b6712d7-9508-4a15-b2b0-09fe3c63416e | 3 | public double getFMeasure(int idx) {
if (idx == 0){
return statistic[idxIDrefsFMeasure];
}else if (idx == 1){
return statistic[idxFEsFMeasure];
}else if (idx == 2){
return statistic[idxIDrefsNIFMeasure];
}else{
return -1.0;
}
} |
8a501457-c971-43d0-ad47-0525529b275f | 3 | private void evalArrayLoad(Type expectedComponent, Frame frame) throws BadBytecode {
Type index = frame.pop();
Type array = frame.pop();
// Special case, an array defined by aconst_null
// TODO - we might need to be more inteligent about this
if (array == Type.UNINIT) {
... |
34f0ebcd-3b1b-4f61-b6c6-11016aafbbd7 | 6 | public static void start()
{
/* 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://download.ora... |
c3730f76-40d9-4f88-80d2-630233eb312f | 7 | public void init(generated.Cards XMLcards)
{
if (XMLcards == null)
throw new NullPointerException("XMLcards is null");
// init "go to" cards
generated.Gotos XMLgotos;
if (_type == SURPRISE)
{
XMLgotos = XMLcards.getSurprises().getGotos();
... |
d25569d1-777a-4c49-a25e-190228cd5ee7 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ThumbsUpPK that = (ThumbsUpPK) o;
if (accountId != that.accountId) return false;
if (replyId != that.replyId) return false;
return tru... |
e49f1105-c7b8-4da3-aefe-db77435c033c | 0 | public Object get(String key) {
return symbols.get(key).getValue();
} |
9a518446-a97a-49db-8aa4-01804f9d056c | 8 | @Override
public boolean isInCombat()
{
if (victim == null)
return false;
try
{
final Room vicR = victim.location();
if ((vicR == null) || (location() == null) || (vicR != location()) || (victim.amDead()))
{
if ((victim instanceof StdMOB) && (((StdMOB) victim).victim == this))
victim.setVic... |
cbc76cdb-a06a-4aaf-b8b4-17db4a9e2d0b | 9 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
m = Integer.parseInt(st.nextToken());
s = new String[n... |
9ec5c874-c6c5-4e63-ae26-1cb74b7c96d6 | 2 | public void update() {
for (int x = 0; x < Standards.CHUNK_SIZE; x++){
for (int y = 0; y < Standards.CHUNK_SIZE; y++){
contents[x][y].update();
}
}
} |
cb689ab3-986b-4693-857c-ac6d3e2e28d3 | 9 | @Override
public Complex product(final Complex factor) {
if (factor == null)
throw new NullPointerException("The factor is not properly specified.");
if (Complex.isNaN(factor) || Complex.isNaN(this))
return Complex.NaN;
if ((Complex.isInfinite(factor) && Complex.isOri... |
1885c60f-fd98-4331-9072-6a8b03483979 | 3 | public ExponentialDialog(final Panel panel) {
setTitle("Exponential");
setBounds(1, 1, 400, 150);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width/3 - getWidth()/3, size.height/3 - getHeight()/3);
this.setResizable(false);
setLayout(null);
JPanel paramPanel = new JPanel();
paramPan... |
3264df11-d83e-46c8-afc3-c52ad9f44dd3 | 7 | public static int lenghtUnitStringToIndex(String unit) {
switch (unit) {
case "m":
return 0;
case "ft":
return 1;
case "mm":
return 2;
case "cm":
return 3;
case "km":
retu... |
909b5090-7843-4dcb-b60e-742428f04403 | 6 | public void click(Point point, Object source) {
if (ca.getMode() == EditorMode.NODE) {
Point p = new Point(point);
p.x += getX();
p.y += getY();
if (pathContainer_.contains(p) || path_.contains(p)) {
father_.deselectAll();
requestFocus();
selected_ = true;
repaint();
return;
} else ... |
f6bf7a20-77d2-48fc-992a-5fefac803c7f | 2 | @Override
public String toString() {
//return "TDS{" + "listeBloc=" + listeBloc + ", num_bloc=" + num_bloc + ", num_imbrication=" + num_imbrication + ", actuelle=" + region_actuelle + '}';
String str="";
Region r;
Entree e;
Symbole s;
for(Entry ent : listeBloc.entrySe... |
e74044b9-e73a-4f1f-9141-f3a67c89b63b | 8 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
super.unInvoke();
if(canBeUninvoked())
if((mob.location()!=null)&&(!mob.amDead()))
{
final Room R=mob.location();
if((R.domainType()==Room.DOMAIN_INDOORS... |
bb20ddd1-b288-4da9-afbd-0d58aac9b0fe | 4 | private boolean isWithinAccLimit(String ipaddress) {
int limit = plugin.getConfig().getInt("registration.account-limit");
if (limit < 1 || xPermissions.has(player.getPlayer(), "xauth.bypass.acclimit"))
return true;
int count = 0;
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps =... |
1f1da4d2-9fa5-492d-8bbd-be8e55aa4f59 | 8 | public boolean equals(Object x) {
if(!(x instanceof Entry))
return(false);
T[] a = arr.get();
if(a == null)
return(false);
Entry<?> e = (Entry<?>)x;
Object[] ea = e.arr.get();
if(ea == null)
return(false);
if(ea.length != a.length)
return(false);
for(int i = 0; i < ... |
41aac8e1-99e5-4a4e-b817-81661adc1f80 | 9 | public Gui()
{
setBackground(new Color(0,50,100));
addMouseMotionListener(this);
addMouseListener(this);
addKeyListener(this);
for(int eks=0; eks<list.length; eks++)
if(eks%2==0) //if it's 0 or 2
x[eks] = (w/3)+(w/18);
else if(eks==1)
x[eks] = 2*(w/3)+(w/18);
else //if (eks==3)
... |
78f90457-0b77-4894-af1a-41677c33b9f8 | 1 | public void output() {
ListElement current = head;
while (current != tail.next()) {
System.out.print(current.getValue() + " ");
current = current.next();
}
System.out.println();
} |
19f62dbe-2572-4fe2-867f-42b174013439 | 2 | public List<vassalInfo> getPlayerVassals(String playerName) {
List<vassalInfo> vassals = new ArrayList<vassalInfo>();
String SQL = "SELECT *" + " FROM " + tblAllegiance + " WHERE `patron` LIKE ?" + " ORDER BY XP DESC;";
try {
Connection con = getSQLConnection();
PreparedStatement statement = con.prepareSt... |
2f683a79-6560-40a6-b3b2-7a7fad60275f | 1 | public SpriteSheet(String relativePath) {
URL u = this.getClass().getResource(relativePath);
try {
spriteSheet = ImageIO.read(u);
} catch (IOException e) {
e.printStackTrace();
}
} |
c12b3cb0-9c8d-40a8-b701-a02618092733 | 3 | @Override
public Component getListCellRendererComponent(JList<? extends TripComponent> list,
TripComponent value, int index, boolean isSelected, boolean cellHasFocus) {
riverNameLabel.setText("Gr " + (index+1) + ": " + value.getRiverName());
wwTopLevelLabel.setText ("\u02AC" + value.getWwTopLevel());
tripF... |
63abc786-ef76-4e73-b18d-8bdfa757273e | 2 | public boolean isCeilingTouched(BlockMap bmap)
{
for(int i = 0; i < bmap.entities.size(); i++)
{
Block tile = (Block)bmap.entities.get(i);
if(ceilingPoly.intersects(tile.poly))
{
return true;
}
}
return false;
} |
035dc9cd-1a56-41ff-b25d-9487a0bb61b4 | 6 | private void calcRotation(double timeMod) {
if (turningRight && turningLeft) {
//Do nothing
} else if (turningRight) {
faceAngle += turnSpeed*timeMod;
} else if (turningLeft) {
faceAngle -= turnSpeed*timeMod;
}
//Make sure faceAngle st... |
25caa6fc-5be3-447e-a3bb-c511dae683f0 | 6 | public static void main(String[] args) throws Exception {
int swValue = 0;
System.out.println("============================================================================");
System.out.println("| MENU SELECTION DEMO |");
System.out.... |
d9769ffc-dafe-447c-975b-a2c91a9320a9 | 4 | private synchronized void dequeue(PacketScheduler sched)
{
Packet np = sched.deque();
// process ping() packet
if (np instanceof InfoPacket) {
((InfoPacket) np).addExitTime( GridSim.clock() );
}
if (super.reportWriter_ != null) {
super.write("dequeui... |
b55b9ce3-524c-4fbb-a45c-e528a9bcb5e7 | 2 | public RandomBitFilter(final ConnectionProcessor proc, final Properties props) {
super(proc, props);
requireConfigKey(probability_key);
probability = Float.parseFloat(props.getProperty(probability_key));
for (int i = 0 ; i < table.length ; ++i) {
for (int j = 24 ; j < 32 ; ++... |
e837dc4b-4698-40b9-9b6d-bb9ca5710b31 | 0 | public CmdRemoveExecutor(SimpleQueues plugin) {
this.plugin = plugin;
} |
453cb57e-54b6-4d96-bbcd-f91f0cb90378 | 9 | public static boolean canMove(Tile[][] board, Tile tile) {
boolean canMove = false;
switch (tile.getSpecialPosition()) {
case TOP_LEFT:
canMove = checkNeighborsFromTopLeft(board, tile);
break;
case TOP_RIGHT:
canMove = checkNeighbor... |
d7e863dc-683b-4f1a-b05b-97aa3fcc3334 | 0 | @Test
public void getNumberOfDaysBillIsOlderThanPaul() throws Exception {
Assert.assertEquals(addressBook.getDaysOlder("Bill McKnight", "Paul Robinson"), 2862);
} |
c60c1c63-0330-401b-85f8-e2396e8aa7db | 1 | @Override
public void dragExit(DropTargetEvent event) {
TreePanel panel = getPanel();
if (panel.getColumns().equals(mOriginal)) {
panel.repaintColumn(mColumn);
} else {
panel.restoreColumns(mOriginal);
}
} |
296510bf-eca6-4484-b0ee-afb13ae4b1b5 | 6 | @Override
public void mouseDragged(MouseEvent event) {
JFrame frame = Game.get().display.getFrame();
float zoomX = (frame.getWidth()-frame.getInsets().left-frame.getInsets().right)/800f;
float zoomY = (frame.getHeight()-frame.getInsets().top-frame.getInsets().bottom)/800f;
int mouseX = (int) (event.getX()/z... |
778e4e16-c14c-434b-aab1-b6550e30168c | 9 | @Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource() == exit)
{
controller.mainWindowClosing();
System.exit(0);
}
if(arg0.getSource() == static_Open || arg0.getSource() == addSong)
{
JFileChooser chooser = new JFileChooser();
File... |
96463b72-34b6-446b-9cb6-b920e5310d5d | 4 | public int getCharge()
{
if(isIon())
{
int pos = 0;
for(int i = 0; i < ions.length; i++)
{
if(this.equals(new MiniCompound(ions[i])))
{
pos = i;
break;
}
}
return ionCharges[pos];
// System.err.println("getCharge - this is an ion, but there isn't a corresponding charge");
}... |
b9e2846b-964c-431c-a710-2f3ce0ea3468 | 8 | int readCorner3(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (rea... |
6a649fa8-de80-4b66-a101-9b9bd80cdc04 | 6 | protected void Fetch(String DBloc) throws IOException, JSONException
{
String found = "";
JSONObject obj;
if(Key == null && Qualifier == null)
{
File file = new File(DBloc+"/"+Table+"/"+ColumnFamily+"/");
read(file);
}
else if(Key == null)
{
FileInputStream fistream = new FileInputStre... |
fafaeac6-d60f-4a93-80e9-f1fc95a5a8e4 | 1 | public Grid createGrid(){
Grid grid = null;
if(fileCanCreateGrid()){
grid = new Grid(this.vehicleMap, this.gridSize, new ArrayList<Grid>());
grid.previousGrids.add(grid);
}
return grid;
} |
037f2992-a1e3-4e27-8f22-f4edecda7af6 | 1 | private boolean isWhitespace(int c) {
return Character.isWhitespace((char) c) && (c != strategy.getDelimiter());
} |
36d18fa2-fe96-4d53-8a0a-06ea5de99b8c | 9 | private void readConfigFile(String filename) {
// Chargement du fichier
Properties prop = new Properties();
try {
prop.load(new FileReader(filename));
} catch (Exception e) {
e.printStackTrace();
}
// Traitement des données chargées
String[] pluginsToLoad = prop.getProperty("loadAtStart").split("... |
d22a3ac3-d7ad-4949-be52-9acd9af69b6a | 0 | public static void main(String[] args) throws Exception {
TesterMainGUIMode testerMainGUI = new TesterMainGUIMode();
testerMainGUI.showChartFrame();
} |
fd840ab2-cb3a-4efb-bdd6-a066956d3f60 | 6 | public static void main(String[] args) {
printWelcome();
// Attempting authentication with server
try {
sock = new ServerConnection().getNewConnection();
new LoginHandler().handleIt(sock, currentUser);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Type \'h\' for a list of c... |
1c3426ec-7c8e-44fc-91ad-cbcfc914ebae | 0 | public int getInt() throws InvalidBEncodingException {
return this.getNumber().intValue();
} |
8564688e-35de-4e0e-ba27-e92beae8bb7c | 7 | public CheckResultMessage checkF(int day) {
BigDecimal f = new BigDecimal(0);
int row = get(10, 2);
int clums = get(11, 2);
int total = get(13, 2);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
for (int i = row; i < total; i++) {
f = ... |
8ff9f21a-8624-49e5-b43f-4c6f028304ef | 4 | private String keyTranslate(String pkgType){
String key = null;
if(pkgType.equals("download")){
key = "Hash";
}else if(pkgType.equals("upload")){
key = "URL";
}else if(pkgType.equals("uploadType")){
key = "Upload Type";
}else if(pkgType.equals("downloadType")){
key = "Download Type";
}else{
k... |
bd738827-0a16-49be-90ed-332ff7296dd3 | 6 | private void match1PlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_match1PlusActionPerformed
if (!heureChoice.getSelectedItem().equals("Tous") && !courtChoice.getSelectedItem().equals("Tous")) {
try {
int terrain = courtChoice.getSelectedIndex();
... |
aa7e77c7-58fc-4f6e-afb4-a9a72677d8c3 | 5 | public IHeuristic getHeuristic() {
IHeuristic ret = null;
switch (HeuristicType) {
case '1':
ret = new Heuristic1();
break;
case '2':
ret = new Heuristic2();
break;
case '3':
ret = new Heuristic3();
break;
case 'c':
ret = new Classifier();
break;
case 'n':
ret = new... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.