method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
17452e6c-d038-4bee-9ac8-418139620aa5 | 5 | protected void wash() throws InterruptedException {
myMachine.setLock(true);
myWaterController.putEvent(new WaterEvent(this, WaterEvent.WATER_DRAIN, 0d));
mailbox.doFetch();
// Pre-wash
myWaterController.putEvent(new WaterEvent(this, WaterEvent.WATER_FILL, 0.5d));
mailbox.doFe... |
7eb2746c-7642-437e-a7f8-bf16304b4ca7 | 9 | @Override
protected boolean mutatesTo(Object oldInstance, Object newInstance) {
if (oldInstance instanceof Class<?> && newInstance instanceof Class<?>) {
Class<?> c1 = (Class<?>) oldInstance;
Class<?> c2 = (Class<?>) newInstance;
if (c1.getName().equals(c2.getName())) {
... |
eebe8bd6-bbfa-4138-9e8e-3cc0b7599ba9 | 7 | private static void TexasHoldEm() {
Table tbl = new Table();
int iPlayers = 5;
Deck dStud = new Deck();
// Add the players, give them empty hands
for (int i = 0; i < iPlayers; i++) {
Player p = new Player("Joe",null);
p.SetPlayerNbr(i+1);
p.SetHand(new Hand());
tbl.AddTablePlayer(p);
}... |
38bf76bc-995c-45a2-89c4-ee755f9b1c80 | 4 | public static int wps2pdf(String srcPath, String destPath) {
File file = new File(srcPath);
if (file.exists()) {
ComThread.InitMTA();
ActiveXComponent wps = null;
try {
wps = new ActiveXComponent("WPS.Application");
wps.setProperty("Visible", false);
Dispatch docs = wps.getProperty("Documents")... |
7fd89d8d-4a0d-46ec-ade2-3191bc5e60b1 | 4 | public ArrayList<PersoonMetGeneratie> b(Gezin ouderlijkGezin, int generatie)
{
int count = 0;
generatie += 1;
ArrayList<PersoonMetGeneratie> localpmg = new ArrayList<PersoonMetGeneratie>();
if(ouderlijkGezin.getOuder1() != null)
if(ouderlijkGezin.getOuder1().getO... |
06efd4e9-03ac-45d1-a252-3d823e97e20e | 4 | private MinuetoImage scaleInternal(double factorX, double factorY) {
/* Reference to the destination image. */
BufferedImage destinationBufferedImage;
/* Reference to the affine transformation (the scale) */
AffineTransform affineTransform;
/* Reference to the GraphicPointer */
Graphics2D graphics2DDestina... |
45130bfb-4ed2-4b34-8591-d930e453f581 | 8 | @Override
public void paintComponent(Graphics g)
{
if(right && !left)
camera_x+=camera_speed;
if(!right && left)
camera_x-=camera_speed;
if(down && !up)
camera_y+=camera_speed;
if(!down && up)
camera_y-=camera_speed;
Graphics2D graphics = (Graphics2D)g;
graphics.setBackground(new Color(40,130,... |
7e616c5e-34a8-47e9-9de9-36daab6ef597 | 9 | @Override
public boolean equals( Object obj )
{
if ( this == obj )
{
return true;
}
if ( obj == null )
{
return false;
}
if ( getClass() != obj.getClass() )
{
return false;
}
Key other = (Key) ob... |
707b8f5d-5976-48f0-94f2-db61c8b86f3c | 2 | public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, true));
shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
Composite composite = new Composite(shell, SWT.NONE);
composite.setLayoutData(new GridData(SWT.... |
3dc745d0-5eb3-4f90-9c41-5cfab1096170 | 5 | @Override
public String toDetailedString() {
StringBuffer buffer = new StringBuffer(super.toDetailedString());
SimpleDateFormat dateFormat = new SimpleDateFormat(
"dd/MM/yyyy HH:mm:ss");
if (this.getParent() != null)
buffer.append("Parent: " + this.getParent() + "\n");
buffer.append("... |
bf6c3f71-043a-4f84-9833-3d301a6957ff | 6 | @Override
public Object getValueAt(int row, int col) {
Contestant player = (Contestant) globalData.get(row);
switch (col) {
case INDEX_ID:
return player.getID();
case INDEX_FIRSTNAME:
return player.getFirstName();
case INDEX_LASTNAME:
return player.getLastName();
case INDEX_TRIBE:
return pl... |
c0fd744c-f635-46d8-be68-a067fb9cb74c | 7 | protected static void test(String[] args)
{
Random r=new Random(System.currentTimeMillis());
int span=200;
int bigDiff=0;
for(int it=0;it<50000;it++)
{
Set<Integer> l=new TreeSet<Integer>();
LongSet g=new LongSet();
for(int i=0;i<200;i++)
{
if(r.nextBoolean())
{
int n=r.nextInt(3)+1;... |
1114c8b5-85ea-4289-9a78-e6332ba98f0b | 7 | public void startInteractiveSpeech() throws IOException, InterruptedException {
Speak.say("The interactive calendar is not complete");
boolean done = false;
while (!done) {
Speak.say("Please say a Calendar command or help for more options");
ArrayList<String> saidArr = speechRec();
if (saidArr == null ||... |
7ec0b33e-7e59-4736-a381-ac36da09110e | 8 | protected Plateau voisin(){
Plateau tmp=new Plateau(plat);
listeTmp=new ArrayList<Polyominos>();
for(Polyominos p : listePolyo){
listeTmp.add(new Polyominos(p));
}
/** on enleve un certain pourcentage de piece qui sont deja placer sur le plateau **/
//melange de la liste des polyominos
Collections.shu... |
75dc641d-4c41-4a6c-aeb2-be7c69eb3c52 | 6 | public AutocompleteJCBQuestion() {
super();
setEditable(true);
Component c = getEditor().getEditorComponent();
if (c instanceof JTextComponent) {
final JTextComponent tc = (JTextComponent) c;
tc.getDocument().addDocumentListener(new DocumentListener() {
... |
59a0638d-f12c-46b2-840d-972726b6c6e0 | 8 | public void move(char dir){
switch (dir) {
case 'W': if(yCord > 0)
yCord -= 1;
else
System.out.println("Invalid move please choose again\n");
break;
case 'S': if(yCord < (Game.ROWS-1))
yCord += 1;
else
System.out.println("Invalid move please choose again\n");
... |
cd9c68dd-3971-444e-b258-ce074611ae3a | 6 | private void Calculate() {
Float value1 = 0.0f;
try {
value1 = Float.parseFloat(input1.getText());
} catch (NumberFormatException ex) {
output.setText("input1 Not supported ");
}
Float value2 = 0.0f;
try {
value2 = Float.parseFloat(inpu... |
be9c6933-2105-42db-bf06-f40bc7d3469a | 6 | private void createElement(String name, Attributes attributes) {
Element element = document.createElement(name);
for (int i = 0; i < attributes.getLength(); i++) {
String attrName = attributes.getLocalName(i);
if (attrName == null || "".equals(attrName)) {
attrName = attributes.getQName(i);
}
if (at... |
18c85046-efc9-4811-a731-b962c96f12cc | 7 | public double funct(double x[]) {
//RefreshDataHandles();
for (int j = 0; j < parameters.length; j++) {
try {
parameters[j] = x[j];
} catch (Exception e) {
throw new RuntimeException("Error! Parameter No. " + j + " wasn^t found" + e.toString());
... |
f2e8b2b3-1362-4043-bdb3-7513411fba12 | 0 | public void setL(Layer l) {
this.l = l;
} |
e6e8d141-a1e9-451c-977c-5a22b22c43bb | 2 | @Override
public boolean getItemCanBeDeleted(String itemId) {
System.out.println("Hello from getAuctionExpired");
boolean itemCanBeDeleted = true;
TypedQuery<Auction> auctionExpiredQuery = emgr.createNamedQuery(
"Auction.findExpiredByItem", Auction.class);
auctionExpiredQuery.setParameter("itemId", Integer... |
8f78790f-26b3-4332-9962-9744580156e8 | 7 | protected void assignCompanion(BoatId id, Point p) throws RemoteException {
// don't hand help to boats that are expected to help others
// also if it's arriving at wharf, let him be!
if (!assignedCompanions.containsKey(id) && !assignedCompanions.containsValue(id)) {
// don't hand helpers that are already help... |
88002c7d-68c2-40b6-b137-5c3a7d89bccd | 2 | private static int clamp(int coord, int max) {
int d = MAX_PRINT_SIZE / 2;
coord -= MAX_PRINT_SIZE / 2;
if (coord + MAX_PRINT_SIZE > max)
coord = max - MAX_PRINT_SIZE;
if (coord < 0)
coord = 0;
return coord;
} |
882824b5-2a26-43f2-8eb8-e3bd94b484e9 | 2 | private static void myMenu(BufferedReader br, ServiceInterface obj,
Scanner cs) throws IOException {
// TODO Auto-generated method stub
System.out.println("1 Update");
System.out.println("0 Logout");
int val = cs.nextInt();
if (val == 0)
showMenu(br, obj, cs);
else if (val == 1)
update(br, obj, c... |
49a1e72f-858b-4e6e-8775-85678f1d7cdb | 8 | @Override
public void initTelnetMode(int attributesBitmap)
{
setServerTelnetMode(TELNET_ANSI,CMath.bset(attributesBitmap,MOB.Attrib.ANSI.getBitCode()));
setClientTelnetMode(TELNET_ANSI,CMath.bset(attributesBitmap,MOB.Attrib.ANSI.getBitCode()));
boolean changedSomething=false;
final boolean mxpSet=(!CMSecurity... |
2d6303bf-4af1-4035-8bc6-d96dfc0aa531 | 8 | public int[] findstem(String ss) {
int[] pos = new int[4];
for (int i = 0; i < ss.length(); i++) {
if (ss.charAt(i) == '(') {
pos[0] = i;
break;
}
}
for (int i = pos[0]; i < ss.length(); i++)
if (ss.charAt(i) == ')') {
pos[2] = i;
break;
}
for (int i = ss.length() - 1; i > 0; i--)
... |
ad26f6a3-0cd8-4c70-808d-1c11978cda0f | 1 | static int [] shiftKTimes(int arr[],int k){
int temp=0;
// int loc=0;
// for(int count=0;count<arr.length;count++){
// loc=count+k;
// if(loc>arr.length-1)
// loc=loc-(arr.length-1);
// temp=arr[count];
// arr[count]=arr[loc];
// arr[loc]=temp;
// }
for(int count... |
5e704d35-892d-41fc-818f-1b6266fe0fcc | 0 | public OutlinerDesktopMenuBar() {} |
8b3bd6fd-ff70-4820-8c95-6a139c80a1c4 | 7 | public Map<String, Enum<?>> getEnumRenames(Class<?> type) {
if (type == null) {
throw new IllegalArgumentException("type must not be null");
}
Map<String, Enum<?>> map = enumRenames.get(type);
if (map == null) {
return new HashMap<String, Enum<?>>();
}
... |
ff4eb194-bbc5-4d27-ae18-db1288abbafd | 5 | private void writeBytes( int db, int ln, byte[] b )
{
RandomAccessFile f = ( db==0 ? fdbf : db==1 ? ffpt : fcdx );
int l = b.length;
try { f.write(b,0,Math.min(ln,l)); }
catch (IOException e) { e.printStackTrace(); }
if(ln>l)
{
try { f.writeBytes(Spaces(ln-l)); }
catch (IOException e) { e.printStack... |
1d9f17d5-f6f2-4ea4-8159-7b7f4e2c2246 | 1 | public void DetailsPraticien(){
if(this.vue.getjComboBoxPraticien().getSelectedItem() != ""){
CtrlPrincipal ctrlP = new CtrlPrincipal();
ctrlP.action(this.vue.getjComboBoxPraticien().getSelectedItem()+"");
} else{
JOptionPane.showMessageDialog(this.vue, "Veuillez choi... |
8fbcc922-9b8c-4e78-912e-272b74f16ff4 | 8 | private int func_74841_a(String par1Str)
{
StringTokenizer stringtokenizer = new StringTokenizer(Strings.func_74830_a(par1Str), " ,");
int i = 0;
do
{
if (!stringtokenizer.hasMoreTokens())
{
break;
}
String s = stringt... |
279b612d-0c6d-4ce0-96e1-ca8fc1394424 | 4 | public Redis(String host, int port, String password) {
if (host == null || password == null || port < 1 || port > 65535) throw new IllegalArgumentException();
this.host = host; this.port = port; this.password = password;
this.connect(this.host, this.port, this.password);
} |
28ed03db-0632-4e79-b2ba-8a5544994812 | 1 | public final void visitTableSwitchInsn(
final int min,
final int max,
final Label dflt,
final Label[] labels)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "min", "min", "", Integer.toString(min));
attrs.addAttribute("", "max", "max", "... |
9e6a306f-30c5-474f-91b3-daf55206795a | 1 | public void deleteFromPlaylist(BEPlaylist aPlaylist) throws Exception {
try {
ds.deleteFromPlaylist(aPlaylist);
} catch (SQLException ex) {
throw new Exception("Could not delete the song from the playlist" + aPlaylist.getName());
}
} |
fc67aaad-a8ff-41f1-8e3f-3673a680a799 | 5 | @Override
public void keyPressed(KeyEvent arg0) {
if (!PiInputField.hasStarted) {
long startingTime = System.currentTimeMillis();
PiInputField.startTime = new Date(startingTime).toString();
AccuracyChecker.startAttempt(startingTime);
Main.debugPrintln("Start time has been set to: "
+ PiInputField.st... |
34459daf-ff5f-49d1-a485-e1286fd0f9f8 | 7 | private boolean isWellFormedABRI(SimpleNode node) throws SimpleNodeMalPositionne {
// On retourne true dans le cas où le noeud est une feuille
boolean ret = true;
if (node != null) {
// Si node a un fils gauche correctement positionné on descend dedans
if (node.getLeft... |
e9527104-9701-4289-b4e4-b46a19242d29 | 7 | public boolean setInitializer(Expression expr) {
if (constant != null)
return constant.equals(expr);
/*
* This should check for isFinal(), but sadly, sometimes jikes doesn't
* make a val$ field final. I don't know when, or why, so I currently
* ignore isFinal.
*/
if (isSynthetic
&& (fieldName.... |
39e72d9f-86c6-430c-8aee-985f9d68668d | 3 | private void
writeChar(
char c )
{
int rem = current_buffer.length - current_buffer_pos;
if ( rem > 0 ){
current_buffer[current_buffer_pos++] = (byte)c;
}else{
int next_buffer_size = current_buffer.length < BUFFER_DOUBLE_LIMIT?(current_buffer.length... |
b8b6ef33-72c5-4d0a-8c96-53fc747e050b | 5 | protected void processOtherEvent(Sim_event ev) {
super.processOtherEvent(ev);
switch (ev.get_tag()) {
case DataGridTags.REGISTER_REPLICA_CTLG:
processRegisterRC(ev);
break;
// receives a request about global RCs from a user or resource
... |
d795d547-9a2d-446b-bf50-f851f2f54985 | 7 | public static void readHash2(String type_map,
HashMap<String, Integer> hashMap) {
ArrayList<String> types = new ArrayList<String>();
ArrayList<String> tokens = new ArrayList<String>();
if (type_map != null) {
readLines(type_map, types);
for (int i = 0; i < types.size(); i++) {
if (!types.get(i).isE... |
d5f16547-98fa-456d-b048-c6023d931a3d | 6 | public void setSpriteAction(ActionState action) {
this.action = action;
if (ActionState.STANDING == action) {
currentSprite = standingSprite;
} else if (ActionState.DUCKING == action) {
currentSprite = duckingSprite;
} else if (ActionState.JUMPING_LEFT == action) {
currentSprite = jumpingLeftSprite;
... |
cf998929-e685-4965-8c1d-42842e7e3bfc | 3 | public static byte[] decompressData(byte[] data) {
Inflater inflater = new Inflater();
inflater.setInput(data);
// Create an expandable byte array to hold the decompressed data
ByteArrayOutputStream stream = new ByteArrayOutputStream(data.length);
// Decompress the data
byte[] buffer =... |
43974a4d-2d3b-4270-ad72-fbb3d354de0c | 8 | public MappaGenerale(Logica myLogica, String token) throws InvalidTokenException {
latoDellaMappa = myLogica.getMappa().getLatoDellaMappa();
Iterator<Cella> itCelle = myLogica.getMappa().iterator();
int i = 0;
Cella tempCella = null;
Character tipoCella = null;
while (itCelle.hasNext()) {
do {
tempCe... |
40a5f6f8-aa57-476e-80ca-3342d43bd764 | 8 | private void visitLiteral(Node node, Node child)
{
int type = node.getType();
int count;
Object[] propertyIds = null;
if (type == Token.ARRAYLIT) {
count = 0;
for (Node n = child; n != null; n = n.getNext()) {
++count;
}
} e... |
9edc4f20-a6f5-4e57-ae48-e46e78b89544 | 5 | public static void main(String[] args) {
int numberRead = 0;
FileReader reader = null;
PrintWriter writer = null;
char[] buffer = new char[512];
if (args.length < 1) {
System.out.println("Usage: java FileView filename");
System.exit(0);
}
try {
// open an input stream on the file args[0]
reade... |
27a23fb3-010c-4716-a833-fb9e01394c7c | 3 | private void drawCircle(int xc, int yc, int r, Graphics g) {
/*
* Declare and initialise local variables.
* The origin is base on positive y-axis at (0,r)
*
* int x and y - Circle coordinates use
* to draw the pixels of circle's 8 arcs.
* int... |
d958d61e-db0c-4343-8fc5-d0ed32be3d48 | 7 | public void InitView() {
selectedRange = DataRange.THREEMONTH;
selectedChart = "line";
pane = new VBox();
lineChart = LinearChartManager.linear();
lineChart.setTitle("");
table = new TableView();
try {
table.getItems().addAll(NetworkManager.show(Data... |
22b7844e-30ea-43fa-80d8-cfc07904a8f3 | 2 | public void setDef(final LocalExpr expr, final Def def) {
if (StackPRE.DEBUG) {
System.out.println(" setting def for " + expr + " to "
+ def);
}
if (def != null) {
defs.put(expr, def);
} else {
defs.remove(expr);
}
} |
b1b784e1-b8a1-460e-9260-bbc18d92e484 | 4 | public String[] ReadPayloadHTTPData() {
String[] FaultTypeOperators = null;
int count = 0;
Statement s = null;
ResultSet rs = null;
// Adapted from http://developers.sun.com/docs/javadb/10.2.2/ref/rrefclob.html
try {
if ((conn = setConn()) != null) {
... |
303d6430-7e78-4dc7-8878-b5743eb7e50d | 0 | public JTable getTableListe() {
return tableListe;
} |
bd10274f-e166-414a-8abc-2a3ca683a1f3 | 8 | private void processSequence(ShortKmer startKmer) {
int value = hm.getWithZero(startKmer.toLong());
StringBuilder sequenceSB = new StringBuilder(startKmer.toString());
long seqWeight = value;
int minWeight = value, maxWeight = value;
ShortKmer kmer = new ShortKmer(startKmer);
... |
fb827b19-64a6-4203-a322-b199bee06148 | 2 | public void characters(char[] ch, int start, int length)
throws SAXException {
if (insidePerson)
Value += new String(ch, start, length);
else if (insideDomain){
publishDomain += new String(ch, start, length);
}
} |
6a5df477-4ed9-4aee-af3e-7a636dd9fb97 | 8 | @Override
public void onEnable() {
if (!this.gitVersion.contains("GITREVISION") || !this.buildVersion.contains("BUILDVERSION")) {
this.logger.log("Initializing v" + this.getServer().getVersion() + " git-" + this.gitVersion + " b" + this.buildVersion + "bamboo");
} else {
this... |
40c55651-59e4-4e9e-a6c5-2ec2e7502204 | 3 | @Override
protected void paintComponent(Graphics graphics) {
Piste[][] k = kartta.getKartta();
for (int i = 0; i < k.length; i++) {
for (int j = 0; j < k[i].length; j++) {
if (k[i][j].getSieni() != null){
piirräSieni(ska... |
c8e18a1d-1db4-4cb9-8f2e-2c99e1503cfb | 1 | protected void fireReceiveMessageEvent(ReceiveMessageEvent evt) throws Exception {
setLastAccessTime(new Date().getTime());
if (receiveMessage != null) receiveMessage.OnReceiveMessagetEvent(evt);
} |
d57ce904-b97f-437b-bd72-37d06a5a4bd2 | 4 | private void DeleteMySQLData() {
Connection conn = null;
PreparedStatement ps = null;
try {
if ((conn = this.JavaDBAccess.setConn()) != null) {
System.out.println(
"Connected to database " + JavaDBAccess.getDatabaseName());
} else... |
cfb7faf8-78c2-494c-8488-05af528b20db | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PositionNum other = (PositionNum) obj;
if (positionNum != other.positionNum)
return false;
return true;
} |
2a3e4c6a-3582-47d8-bd7d-4866dc299d86 | 6 | protected boolean find_recovery_config(boolean debug)
{
Symbol error_token;
int act;
if (debug) debug_message("# Finding recovery state on stack");
/* Remember the right-position of the top symbol on the stack */
Symbol right = ((Symbol)stack.peek());// TUM 20060327 removed .right
... |
42241c54-72f7-4b52-8d89-38ebc4381e93 | 5 | public void scanForLocalVersions()
{
File versionPath = new File(Util.minecraftDirectory + "/versions");
if (!versionPath.exists())
{
Log.e("Cannot find version directory.");
return;
}
else if (!versionPath.isDirectory())
{
Log.e("A... |
cfecca62-9228-47a7-a817-310b33126b57 | 7 | public static void checkAdjacent(char[][] board, boolean[][] dp,
boolean[][] visited, int i, int j) {
if (i <= 0 || i >= board.length - 1 || j <= 0
|| j >= board[0].length - 1)
return;
if (visited[i][j] == true)
return;
if (board[i][j] == 'X')
return;
visited[i][j] = true;
if (board[i][j] == ... |
088b168d-36ad-4ffe-97cc-5370920907f5 | 6 | public String convertToText(Board board) {
StringBuilder outStr = new StringBuilder();
outStr.append("╔");
for (int i = 0; i < board.getWidth(); i++) {
outStr.append("═");
}
outStr.append("╗\n");
for (int row = 0; row < board.getHeight(); row++) {
... |
a6686efa-02d1-4bf9-8878-d5ccb0a57c7e | 6 | public void fillDeclarables(Collection used) {
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz);
if ((Options.options & Options.OPTION_ANON) != 0 && outer != null
&& outer.outer == null && outer.name != null
... |
e37f5182-60ad-4a7f-954d-2e53461e1dbd | 8 | public void trimBackLogEntries(final String[] channels, final int maxMessages, final long oldestTime)
{
for(final String channelName : channels)
{
final int counter = getCounter(channelName, false);
DBConnection D=null;
try
{
D=DB.DBFetch();
if((maxMessages == 0) && (D != null))
{
D.up... |
59f31b25-252d-4923-ab0b-474f4f49b001 | 7 | public void tick(){
if (x + xa>0 && x + xa <GamePanel.WIDTH - width) {
x = x + xa;
}
if (collision2()) {
BlockModeState.block = new FallingBlocks(Random(15, 120),Random(15, 120));
FallingBlocks.lives--;
Sound.playBlockHit();
}
if (collision3()) {
BlockModeState.block2 = new FallingBlocks(Rand... |
b6549710-5285-4ec2-8b82-849ed77b2dd4 | 1 | public static void main(String[] args) {
// TODO Auto-generated method stub
Studieprogramma sp1 = new Studieprogramma(new Datum(1,1,2010), new Datum(31,12,2010));
sp1.addVak("Nederlands");
sp1.addVak("Engels");
sp1.addVak("Scheikunde");
sp1.addVak("Natuurkunde");
Student s1 = new Student("Sander", 45... |
895bb2a1-7592-46f8-9a5c-790d347299af | 0 | @Override
public String getLabelText() {
return this.labelText;
} |
8d68cd98-2f81-4a5e-871c-6eaa3f20b7e4 | 0 | public String getWrite(int tape) {
return (String) toWrite.get(tape);
} |
80b7381f-e5c7-4497-a82b-3ac9f7249a5a | 3 | @Override
public void run() {
logger.info("Listener thread started.");
try {
Connection connection = factory.createConnection();
connection.start();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination dest = new ActiveMQTopic(topic);
MessageConsumer consume... |
2f874138-0f08-4e0e-a690-87278a90cbc4 | 7 | private List<Integer> findTableChanges() {
List<Integer> changes = new ArrayList<Integer>();
ReferenceTable.Entry[] entries = versionTable.getEntries();
for (int i = 0; i < versionTable.getEntryCount(); i++) {
ReferenceTable.Entry entry = entries[i];
if (entry.getCRC() == 0 && entry.getVersion() ==... |
947edb9b-9188-4d68-b6f0-3477bdcd29ff | 5 | private void calculate(){
int cellstate = 0;if(name == "BlinkCell"){ neighbors[4] = active;}
for (int v = 0; v < neighbors.length; v++){
if(v == 4){self = neighbors[v];}else{if(neighbors[v]){cellstate += 1;}}
}
if(self){active = survives[cellstate];} else{active = born[cellstate];}
} |
85992d54-7d25-47a5-b1b8-750a39f929e1 | 7 | public Quaternion toQuaternion() {
float x = get(0) - get(5) - get(10);
float y = get(5) - get(0) - get(10);
float z = get(10) - get(0) - get(5);
float w = get(0) + get(5) + get(10);
int biggestIndex = 0;
float biggest = w;
if(x > biggest) {
biggest = x;
biggestIndex = 1;
}
if(y > bigge... |
532506a5-52bf-415b-9a0d-bd8f4c2482f4 | 5 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
{//GEN-HEADEREND:event_jButton1ActionPerformed
if (!gameover) {
if (rule.turn()) {
if (rule.check(0, 0)) {
rule.pressed(0, 0);
if ... |
70ea9cc4-5a48-434f-bfb0-bb4655e97d73 | 4 | public Game getGame() {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: getGame() BEGIN");
}
if (test || m_test) {
System.out.println("GameWindow :: getGame() END");
}
return m_gameControl;
} |
a6be9e78-e52b-4f17-bb6e-b7c5b1a431a9 | 9 | public void handleLoadMachineButton() {
if((loadView.getFileList().getSelectedIndex() >=0) && (loadView.getFileList().getSelectedValue() != null)){
String machine = (String)loadView.getFileList().getSelectedValue();
File directory = new File("Saved/" + machine);
File model = new File(direct... |
8cec4e4f-4c20-447f-8e84-ec33732d0b36 | 8 | private void setInvalidPos(int[][] visited, int i, int j) {
for (int t = 0; t < visited.length; t++) {
if (visited[i][t] == 0) {
visited[i][t] = -1;
}
if (visited[t][j] == 0) {
visited[t][j] = -1;
}
}
for (int t = 0;... |
4a5335c4-8987-4895-ad42-2046c4275ce4 | 9 | private static void initialSetup() {
SQLiteHandler sqlite;
try {
sqlite = new SQLiteHandler(Config.DATABASE);
} catch (SQLiteException e) {
e.printStackTrace();
return;
}
// Create all the tables if they don't exist yet
// This should only happen the first time the application is run on a comput... |
24abd118-faa2-4cf0-89bf-b36af55723e6 | 4 | public XYLocation locationAt(Direction direction) {
if (direction.equals(Direction.North)) {
return north();
}
if (direction.equals(Direction.South)) {
return south();
}
if (direction.equals(Direction.East)) {
return east();
}
if (direction.equals(Direction.West)) {
return west();
} else {
... |
453351be-69fd-4bc6-ae28-6616fd78f26d | 9 | private void addLink(Link link) {
final String assId = "ass" + UniqueSequence.getValue();
if (link.getType().getDecor1() == LinkDecor.EXTENDS || link.getType().getDecor2() == LinkDecor.EXTENDS) {
addExtension(link, assId);
return;
}
final Element association = document.createElement("UML:Association");
... |
cf46a0d8-bb25-4587-8401-301e8a585c81 | 9 | private static Spore_Print_Color loadSporePrintColor(String spore_color)
{
if(spore_color.equals("k"))
{
return Spore_Print_Color.black;
}
else if(spore_color.equals("n"))
{
return Spore_Print_Color.brown;
}
else if(spore_color.equals("b"))
{
return Spore_Print_Color.buff;
}
else if(spore_... |
6ee41ca6-1dcb-42f9-9605-f10979c943da | 1 | @Override
public boolean equals(Object obj) {
if (obj instanceof Node) {
return this.getNodeID() == ((Node) obj).getNodeID();
}
return false;
} |
4e5c4562-8ff6-4b69-8c2b-f1532e3de7cf | 6 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int d = in.nextInt();
ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>();
boolean[] visited = new boolean[n+1];
g.add(new ArrayList<Integer>());
for(int i=1;i<=n;i++){
visited[... |
ff1c045f-9c53-4ec0-a701-6cca7447f4ab | 0 | public String[] login()
{
return new String[]{ userName(), password() };
} |
e0bb4890-c4cc-4d05-8473-d4181089761d | 8 | private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
int var7 = (par5 == 0 || Block.blocksList[par5] == null ? 0 : Block.blocksList[par5].getLightValue(this, par2, par3, par4));
int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) -... |
d4c816c2-cef7-4908-9ba3-86f3d0c8f9e1 | 4 | @Override
public void onDisable() {
// Deregister all modules.
List<Class<? extends IModule>> clazzez = new ArrayList<Class<? extends IModule>>();
clazzez.addAll(modules.keySet());
for(Class<? extends IModule> clazz : clazzez) {
this.deregisterModuleForClass(clazz);
}
} |
b19989f9-d829-4606-afd3-c475a52bed09 | 9 | @SuppressWarnings("unchecked")
public static boolean validate(Class<?> clz,HttpServletRequest req) {
Field[] fs = clz.getDeclaredFields();
boolean isValidate = true;
Map<String,String> errors = (Map<String,String>)req.getAttribute("errors");
for(Field f:fs) {
if(f.isAnnotationPresent(ValidateForm.class)) {
... |
141dc0f8-3c39-46fb-9f75-79b14e813669 | 5 | public static Dimensions getDimensions(BlockFace facing)
{
int xLength = 0;
int yLength = HEIGHT;
int zLength = 0;
if (facing == null)
{
xLength = WIDTH;
zLength = DEPTH;
return new Dimensions(xLength,yLength,zLength);
}
switch (facing)
{
case NORTH:
case SOUTH:
xLength = WIDTH;
... |
108ebb8d-2ac6-4b1b-92b1-c88057f487ac | 9 | private void getLogInformation() {
// Get the log entries from the log
LogEntryText[] orderedLog = logger.getLogEntriesOrdered();
// 1. Query each entry to fill the structure
LogEntryType evt = null;
HashMap<Long, LogJobInfo> logInfo = new HashMap<Long, LogJobInfo>();
ownJobsToIgnore = new HashSet<Long>();
... |
2717b77c-6471-42f3-8981-250d379c0c14 | 2 | public int getHeight(){if(dir=='u'||dir=='d')return 102; return 84;} |
a3341253-b3f2-435e-98af-7b1dec116234 | 1 | public boolean deleteTable(String errorMessage) {
String table;
StringTokenizer tk = new StringTokenizer(errorMessage, "\"");
tk.nextToken();
table = tk.nextToken();
try {
stmt.executeUpdate("DROP TABLE " + table + " CASCADE;");
} catch (SQLException e) {
//e.printStackTrace();
error = e.getMess... |
a2da6f40-573a-4932-a453-ae15ae103eae | 7 | private static int[] merge(int[] left, int[] right) {
int[] result = new int[left.length + right.length];
int iLeft = 0, iRight = 0, iResult = 0;
while (left.length > iLeft || right.length > iRight) {
if (left.length > iLeft && right.length > iRight) {
if (left[iLeft] <= right[iRight]) {
result[iResul... |
212525bb-bbd1-49e4-89b0-afc505476432 | 5 | @Override
public ImageIcon getIcon(Item it) {
Fire f = (Fire) it;
position p = f.getPos();
int i=0;
switch (p){
case CENTER:
i=0;
break;
case SIDE:
i=1;
break;
case UP:
i=2;
break;
}
return i<=0 ? icon : i!=2 ? icon2 : icon3;
} |
48cbadbb-d6cf-46b3-b1e7-ee4e235029ac | 1 | public final JSONObject getJSONObject(String key) throws JSONException {
Object o = get(key);
if (o instanceof JSONObject) {
return (JSONObject)o;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONObject.");
} |
8b70b3e6-68ce-4a82-b726-f50d5c8d17a0 | 5 | private String getCommand(String command, String data)
{
// Service.WriteLog("сформировал команду");
byte[] dataByte = null;
if (data != null && data.length() > 0)
{
dataByte = HexTools.fromHexString(data);
}
byte[] comm = HexTools.fromHexString(command);... |
533a251b-5de5-450b-acc9-80eaecf1e3c6 | 4 | public static void main(String[] args) {
List<String> strList = new ArrayList<String>();
strList.add("one");
strList.add("two");
strList.add("three");
for (String str : strList)
System.out.println(str);
strList.remove(1); // two 제거
System.out.println("## String 리스트에서 1번째 인덱스의 object 를 제거 한 뒤 ###");
... |
6b233a34-e9f3-4c81-8fa1-5c76c72fc3ce | 3 | public static void main(String argv[]) throws Exception
{
// if (argv.length != 1) {
// System.err.println("usage: java URLClient [url]");
// System.exit(1);
// }
URL u = new URL("http://www.seu.edu.cn"); // argv is in the form "http://www.yahoo.com/"
HttpURLConnection uC;
int responseCode;
InputStream... |
b0947025-45d5-4d00-adfb-b35a641d32d9 | 9 | public void mouseDragged(MouseEvent e) {
if( mouseOffset != -1 ) {
double pos = 0;
if( orientation == HORIZONTAL ) {
mouseCoord = e.getX();
pos = (mouseCoord - sliderLeftPadding - mouseOffset) / ((double)getEffectiveWidth()) ;
} else {
mouseCoord = e.getY();
pos = (g... |
dc2e904a-3625-4ca0-833e-b321163f7645 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuilder sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new St... |
83b9e036-9b8d-4aed-9024-e1ede0dfb91e | 5 | public CheckResultMessage checkDayofMonth1() {
int r1 = get(6, 2);
int c1 = get(7, 2);
date();
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (!(getValueString(r1 - 1, c1 + maxDay, 1).equals(maxDay
+ "日"))) {
return e... |
8f8664f0-de76-4739-9c6f-9b88d69c27fe | 8 | public void randomize() {
p_base_freq = Math.pow(frnd(2.0f) - 1.0f, 2.0f);
if (rnd(1) > 0)
p_base_freq = Math.pow(frnd(2.0f) - 1.0f, 3.0f) + 0.5f;
p_freq_limit = 0.0f;
p_freq_ramp = Math.pow(frnd(2.0f) - 1.0f, 5.0f);
if (p_base_freq > 0.7f && p_freq_ramp > 0.2f)
p_freq_ramp = -p_freq_ramp;
if (p_base_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.