method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d377eb4d-0f89-4354-8e4e-f100e94875bd | 7 | public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if(action.equals("Next")){
SlideShow.this.counter++;
if(SlideShow.this.counter==SlideShow.this.numberPhotos)
SlideShow.this.counter=0;
SlideShow.this.slideArea.remove(picture);
SlideS... |
d7fe5c3f-eefd-4213-8eec-9a7e0a3ac8d3 | 4 | Long hash(Path file) throws IOException
{
if (NOHASH_FILES.contains(getFileEnding(file)))
{
return Files.size(file);
}
InputStream inputStream = null;
try
{
inputStream = Files.newInputStream(file);
byte[] currentChunk = new byte[8192];
while (inputStream.read(currentChunk) > -1)
{
adle... |
d6340d44-4aac-4db6-8fe6-7012513f3bb4 | 3 | public void generateLevel() {
for (int y = 0; y < Height; y++) {
for (int x = 0; x < Width; x++) {
if (x * y %17 <15) {
tiles[x + y * Width] = Tile.Grass.getid();
} else {
tiles[x+y * Width] = Tile.TallGrass.getid();
}
}
}
} |
57cff1e9-9379-4d4d-9aa9-977d7be114c1 | 2 | public static void endThread(final int ThreadId){
for(ArrayList Me : ServerThreadList){
Object Targ = Me.get(0);
int ObjId = (Integer)Targ;
if (ObjId == ThreadId){
AliveThreadsID[ObjId] = 0;
Thread Threaded = (Thread)Me.get(1);//the thread
... |
3bc8d722-dc2e-4206-9cb2-597161c91b17 | 1 | public void insertStructuredBlock(StructuredBlock insertBlock) {
if (methodHeader != null) {
insertBlock.setJump(new Jump(FlowBlock.NEXT_BY_ADDR));
FlowBlock insertFlowBlock = new FlowBlock(this, 0);
insertFlowBlock.appendBlock(insertBlock, 0);
insertFlowBlock.setNextByAddr(methodHeader);
insertFlowBlo... |
d8f111ad-f777-4bd9-9198-927af1bc1911 | 9 | protected byte[] findBases(SAMSequenceRecord record, boolean tryNameVariants) {
{ // check cache by sequence name:
String name = record.getSequenceName();
byte[] bases = findInCache(name);
if (bases != null) {
log.debug("Reference found in memory cache by name: " + name);
return bases;
}
}
St... |
35da2e07-d694-4c94-b42a-ced8ec46d142 | 3 | public boolean containsKey (K key) {
int hashCode = key.hashCode();
int index = hashCode & mask;
if (!key.equals(keyTable[index])) {
index = hash2(hashCode);
if (!key.equals(keyTable[index])) {
index = hash3(hashCode);
if (!key.equals(keyTable[index])) return containsKeyStash(key);
}
}
return... |
34b90544-7e8b-4406-b52b-f09bddc24aab | 8 | public void setBackgroundColor(String s) {
final String BGCOLOR_PLACEHOLDER = owner.getResource("splitter.placeholder.transparent", "Transparent");
String prevText = this.bgcolor.getText().trim().isEmpty() ? BGCOLOR_PLACEHOLDER : this.bgcolor.getText();
Color col = null;
if (!IOSImageUtil.isNullOrWhiteSpace(s))... |
ab73c0de-945f-4cf7-94c8-581f45ea31bb | 6 | public void upgrade(File file) throws IOException {
LinkedHashMap<String, String> nodes = new LinkedHashMap<String, String>();
if (this.tpl.getString("error.bank.exists") == null) {
nodes.put("tag.money", "<green>[<white>Money<green>] ");
nodes.put("tag.bank", "<green>[<white>Bank<green>] ");
... |
68352f94-d102-4eef-ab9f-35645735084b | 8 | public void nextInternPhase(){
internPhase=(internPhase+1)%3;
currentPlayer=0;
if(internPhase==1){
checkOrder();
}else if (internPhase==2){
System.out.println("Consolidation !");
//on retire les ordres consolidations(sans étoiles) pour chaque familles
for(Family family ... |
a23d5f86-d797-487f-b782-c2358a27136c | 5 | public Map<String, Object> getExecutionResults() {
Map<String, Object> map = new HashMap<String, Object>();
int status = -1;
try {
status = process.waitFor();
outReader.join();
errReader.join();
StringWriter outWriter = outReader.getResult();
outResult = outWriter.toString();
outWriter.close();
... |
af0c12eb-352e-4601-8f77-6a055d4e91d7 | 1 | public void writeNart(CycNart cycNart)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeNart = " + cycNart.toString());
}
write(CFASL_EXTERNALIZATION);
write(CFASL_NART);
writeList(cycNart.toCycList());
} |
abe1e968-a85d-4db9-afdd-c8d88e3c0344 | 8 | private Method getInterfaceMethod(Class<?> clazz, String methodName,
Class<?>[] parameterTypes) {
do {
// Get interfaces
Class<?>[] interfaces = clazz.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
// Ignore non-public interfaces
if (!Modifier.isPublic(interfaces[i].getModifiers())... |
83524df7-c43e-4312-8a9f-e11f74cc669d | 8 | @Override
public void mouseMoved(MouseEvent e) {
// TODO Auto-generated method stub
int x = e.getX ();
int y = e.getY ();
if (back.contains (x, y))
back.setState (1);
else
back.setState (0);
if (help.contains (x, y))
help.setState (1);
else
help.setState (0);
if (earthquake.contains(x, y))... |
17482e27-20fe-4ca9-9ae4-d9254893b0e0 | 8 | public static boolean isPrime(long n) {
if (n < 2)
return false;
if (n == 2 || n == 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
long sqrtN = (long) Math.sqrt(n) + 1;
for (long i = 6L; i <= sqrtN; i += 6) {
if (n ... |
a9effded-aafa-44d8-be4b-28a2d865ccf7 | 3 | private static void playBackgroundMusic()
{
try
{
new Thread()
{
public void run()
{
try
{
while(true)
{
int choose = random.nextInt(SOUNDTRACK_PATHS.length);
soundtrackClip = Applet.newAudioClip(SoundsOfEmpire.class.getResource(SOUNDTRACK_PATHS[choose... |
8081dd20-6d84-437f-a4bb-e1be16b3cf90 | 0 | public void setDescription(String description) {
this.description = description;
} |
feb67f1e-e8a7-4ac4-8de1-3c35070f20a3 | 1 | public boolean WriteToFile(String data)
{
boolean result = false;
try
{
//write data to file
br.write(data);
br.newLine();
//set the status flag
result = true;
}
catch(Exception e){}
return ... |
c1e43e49-118d-458b-a915-12c29d49ca7f | 7 | public Grid drawWorld(int i, int killed) {
ArrayList<Background> BackGrounds = new ArrayList<Background>();
if (i == 1) {
BackGrounds = this.world1();
}
Background a = BackGrounds.get(0);
Grid g = new Grid(killed);
HashMap<Point, GridSpace> grid = g.getGrid();
for (int d = 0; d < 101; d++) {
for (i... |
e178e7de-12df-402b-a98e-fb1e45b68711 | 5 | /* package */TrackerRequest (
Sha1Hash infoHash, PeerId peerId, int port, long uploaded, long downloaded, long left, Boolean compact,
boolean noPeerId, Event event, InetAddress ip, int numWant, int key, byte[] trackerId)
{
if (infoHash == null)
throw new NullPointerException("Nul... |
ba9dcfd6-7045-44f7-a6d3-ab04898a3bc3 | 7 | public String simplifyPath(String path) {
String[] paths = path.split("/");
Stack<String> stack = new Stack<String>();
for(int i=0; i<paths.length; i++){
if(paths[i].equals(".") || paths[i].equals("")) continue;
else if(paths[i].equals("..")){
if(!stack.isEmpty(... |
d28f2fa4-a524-4d7d-8683-6aa252c2318e | 8 | protected boolean disconnectInput(NeuralConnection i, int n) {
int loc = -1;
boolean removed = false;
do {
loc = -1;
for (int noa = 0; noa < m_numInputs; noa++) {
if (i == m_inputList[noa] && (n == -1 || n == m_inputNums[noa])) {
loc = noa;
break;
}
}
if (loc >= 0... |
5d6f3f07-e7d6-4767-bedc-ba783f31dbb0 | 7 | public void CreatePopulation(int popSize)
throws Exception{
InitPopulation(popSize);
/** Delimit the best attributes from the worst*/
int segmentation =m_numAttribs/2;
/*TEST*/
/* System.out.println ("AttributeRanking");
for (int i = 0; i <attributeRanking.size (); i++){
if(i ==segmentation)S... |
2c6525b5-54e6-4a9f-a150-f081a90011e7 | 0 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
calculateEnabledState(e.getDocument());
} |
061a03cb-5d3c-4eec-af6c-4b27b5a29fd5 | 9 | private void initTimeline() {
timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
KeyFrame kf = new KeyFrame(Config.ANIMATION_TIME, new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
if (state == STATE_SHOW_TITLE) {
... |
0325ed41-6be4-437f-8bc1-7c6d686505d9 | 5 | public boolean hasPotentialAvailableSpace(int fileSize) {
if (fileSize <= 0) {
return false;
}
// check if enough space left
if (getAvailableSpace() > fileSize) {
return true;
}
Iterator it = fileList_.iterator();
File file = null;
... |
6b3c57e8-2cb5-4ff9-aae5-33a7ceac73ed | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((decodedValue == null) ? 0 : decodedValue.hashCode());
result = prime * result + ((encodedValue == null) ? 0 : encodedValue.hashCode());
result = prime * result + ((symmetricKey == null) ? 0 : symmetricKey.hash... |
1fa0b820-9780-435f-a34a-871eaf510463 | 1 | @Override
public boolean interpret(String context) {
return expression1.interpret(context) && expression2.interpret(context);
} |
23f00270-a9a5-4524-8bec-b350edc8283b | 8 | private static List<ChunkHolder> getChunks( List<Holder> list )
{
List<ChunkHolder> chunks = new ArrayList<ChunkHolder>();
ChunkHolder currentChunk = null;
int lastIndex = 0;
while(lastIndex < list.size())
{
Holder thisHolder = list.get(lastIndex);
if( currentChunk == null)
{
if(thisHol... |
4d8c0a36-c5fa-449b-9d2c-db8147c18bb1 | 8 | public String getResponseString(String url) {
String lineText;
StringBuilder sb = new StringBuilder();
InputStreamReader isr = null;
int failCount = 0;
do {
try {
getMethod.setURI(new URI(url));
HttpResponse response = httpClient.execute(getMethod);
int status = response.getStatusLine().getStat... |
7ff7f39d-51d2-41bb-8236-dfbaa679bfe0 | 0 | public int GetFirstTicks()
{
//get the tick time the person got to the stop for the bus
return firstTicks;
} |
ae6837e0-9c80-4d78-9487-fab2ac7bcd86 | 4 | @Override
public void Redo()
{
Rectangle obr = getObjectRectangle();
for (LevelItem obj : objs)
{
Rectangle r = obj.getRect();
r.x += XDelta;
r.y += YDelta;
r.width += XSDelta;
r.height += YSDelta;
obj.setRect(r);
... |
05f6ea97-ab84-439a-a581-69a02c735f70 | 3 | protected void setPosition(Position position) {
if (position == null)
throw new IllegalArgumentException("Position can't be null");
if (position.xCoordinate < 0 || position.yCoordinate < 0)
throw new IllegalArgumentException("The given position is invalid!");
this.position = position;
} |
1d4891ad-ed5b-4a40-a098-d45e7525dced | 0 | public void setIdSolicitud(int idSolicitud) {
this.idSolicitud = idSolicitud;
} |
951c55ec-fa1d-4b74-85cd-33a3234e93dd | 9 | private void insertDemoProducts(){
try {
db = new DataBase();
Random randomNumbers;
int n=0;
for(int i=0;i<=20;i++){
con = db.getConnection();
statement = con.createStatement();
randomNumbers = new Rando... |
a1c8c81e-4fd2-4da9-afe0-6f3118a6160a | 8 | public ArrayList<Vertex> gpsrPath(int sourceIndex, int sinkIndex) {
DijkstraVertex sourceVertex = new DijkstraVertex();
DijkstraVertex sinkVertex = new DijkstraVertex();
DijkstraVertex currentVertex = new DijkstraVertex();
DijkstraVertex tempVertex = new DijkstraVertex();
ArrayList<Vertex>... |
3e298ca1-f563-4f3e-9185-b5a2727b8f5e | 0 | void calcVelocity(float dT){
SimpleVector dVelocity = new SimpleVector(this.acceleration);
dVelocity.scalarMul(dT);
this.velocity.add(dVelocity);
} |
bc217854-7c21-4af6-9253-1c98aae60029 | 4 | public boolean removeBalance(int num, double monto){
boolean state=false;
if(!activo.validateTipo(Usuario.LIMITADO)){
if(num>0 && monto>0){
int index = searchIndex(num, !state);
if(index>=0){
return remove(index, monto);
}
... |
273ef6d7-a9d0-48f7-96af-441250d2a2c3 | 1 | public void quit() {
for (Player player : players) {
player.stop();
}
} |
a30d493a-0566-48fa-ae71-b73bbcc7ab3f | 5 | public static void maxheap(int array[], int i) {
int left = 2 * i;
int right = 2 * i + 1;
int parent = i;
if (left <= N && array[left] > array[i])
parent = left;
if (right <= N && array[right] > array[parent])
parent = right;
if (parent != i) {
swap(array, i, parent);
maxheap(array, parent);
}... |
12e2bcc8-f3ea-4f0a-a55f-1aeae0be6b20 | 3 | @Override
public void keyPressed(KeyEvent k) {
//System.out.println("Key pressed: " + k.getKeyCode());
if (k.getKeyCode() != 17 && !this.ctrl) {
this.saved = false;
}
else if (k.getKeyCode() == 17)
this.ctrl = true;
} |
c20f9a11-cd7b-4bd5-a795-bfc8b7149be7 | 6 | /* */ public void paintComponent(Graphics paramGraphics)
/* */ {
/* 37 */ int i = getWidth() / 2 + 1;
/* 38 */ int j = getHeight() / 2 + 1;
/* 39 */ if ((this.img == null) || (this.img.getWidth(null) != i) || (this.img.getHeight(null) != j)) {
/* 40 */ this.img = createImage(i, j);
/* */ ... |
f89c7804-1999-4cf8-b76f-0676a0589104 | 8 | public void run() {
try {
while (true) {
int n = selector.select();
if (n == 0) {
continue;
}
keys = selector.selectedKeys();
Iterator<SelectionKey> iter = keys.iterator();
while (iter.hasNext()) {
SelectionKey key = iter.next();
iter.remove();
if (key.isValid()) {
... |
575b5f5d-a2d6-4361-a480-cdfeb50f6867 | 0 | @Override
public void startDocument () {} |
5b77d122-564a-4a70-b7d6-50851ba13415 | 5 | public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String fromname = request.getParameter("fromname");
Date date = new Date();
String dates = " -at " + date;
String all = date + "!" +fromname;
String toname = request.getParameter(... |
b184231f-6a10-4ad7-8e84-3a284adb0181 | 5 | public void generateMineshaft(int x,int y){
int length = rand.nextInt(SIZE/2);
boolean up = rand.nextBoolean(); // false if in left-right
for(int i=x;i<length+x;i++){
if(i>=SIZE || y+1>=SIZE || y+2>=SIZE) return;
if(up){
world[y][i] = TileType.WOOD;
... |
a7dc0934-b69d-4313-9f35-db30ca606a53 | 7 | private char getElement(Coordinate current) {
MazeNode currentNode = game.getNode(current);
if (game.isMouseAtLocation(current) && game.isCatAtLocation(current)) {
return DEAD;
}
else if (game.isMouseAtLocation(current)) {
return MOUSE;
}
else if (game.isCatAtLocation(current)) {
return CAT;
}... |
193ce21c-f79e-4975-b724-55cfc7549e39 | 8 | */
public static void createSingleton(String[] args) {
//modifications by Zerbetto 05-12-2007
String fileName = null;
boolean showFileMenu = true;
if ((args != null) && (args.length > 0)) {
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.startsWith("file="... |
0b1071f5-dd2e-435c-9e66-c4ed69fd2765 | 0 | public LSystemInputEvent(LSystemInputPane input) {
super(input);
} |
e8f52847-af19-49f1-bc7d-4b7c0cb251ec | 3 | public Note setNote( final Note newNote ) {
if( null == newNote ) {
return null;
}
final long noteId = newNote.getId();
final Note oldNote = notes.put( noteId, newNote );
if( null == oldNote ) {
notifyNotesChangedListeners();
}
if( !newNote.equals( oldNote ) ) {
notifyNoteChangedListeners( new... |
1bce2eeb-cf0b-456c-8690-7a6886fa31f5 | 7 | public StackState constructorCall(int initializedValueStackPosition, StackEntry entry) {
List<StackEntry> newContents = new ArrayList<StackEntry>(contents.size());
if (entry.getType() == StackEntryType.UNINITIALIZED_THIS) {
for (int i = 0; i < contents.size() - 1 - initializedValueStackPosit... |
8d91278b-e838-444f-b81b-b067619f26cf | 7 | private final void progressCheck(boolean useTime, double progressFactor, double progressOffset) {
Matcher m = ProgressCallbackThread.progressPattern.matcher(this.progressScanner);
Matcher m2;
int start = 0, pos;
long time;
int flags;
int frame;
while (m.find(start)) {
// Parse
time = 0L;
... |
ddbc5c97-40f3-43b2-abe2-94fe0a5d6742 | 4 | protected void showClassInfo (StringBuffer buf)
{
try {
buf.append ("<b>Rio Status</b><br>\n");
if (getRio () == null) {
buf.append ("<em>Device claimed by another driver.</em>");
buf.append ("<br><br>\n");
return;
}
rio.start ();
showStorage (buf, false);
if (rio.hasExternalM... |
af25f198-3cae-4ed7-9190-756e4ff81cb6 | 9 | public static int getDaysNumber(int m, int y) {
switch(m) {
case 2:
return isALeapYear(y) ? 29 : 28;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
de... |
14db88ea-414c-43ea-95b8-2b45afe4343a | 5 | public static void main(String[] args) throws Exception {
args = new String[] { "-c" };
try {
File collectionFile = new File(args[1]);
if (args[0].equals("-c")) {
assert !collectionFile.exists();
collectData(collectionFile);
} else if (args[0].equals("-ag")) {
assert collec... |
27740b5f-f9a1-4bfe-b934-539899b4b12b | 4 | public void insertionSort (int[] array, int a, int b) {
int i = a, j = a-1;
while (i <= b) {
int key = array[i];
int k = i-1;
while (k > -1 && array[k] > key) {
array[k+1] = array[k];
k--;
}
if (k+1 != i) {
... |
80b6a928-b7d3-4d61-aea4-866212fbd95f | 5 | public static void checkCost(String s) throws Exception {
for (char c : s.toCharArray()) {
if (!((c >= '0' && c <= '9') || c == ',' || c == '.')) {
throw new Exception("В поле с ценой недопустимые символы: ");
}
}
} |
69303d0e-a0d4-42b0-b9fe-c1db0523f13e | 1 | public String getStatus(int status) {
try {
isAValidKey(status);
} catch (Exception e) {
e.printStackTrace();
}
return getStatusCodesMap().get(status);
} |
4eed9bc2-2cec-4b27-b9dd-5e9306065faf | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(L("@x1 is alread... |
2ee64fcd-bb6e-4bd2-a867-423252821fc3 | 4 | private static void checkIntWordRange(Token token, int value)
throws TokenCompileError {
if((value >= 0 && (value & 0xffff0000) != 0)
|| (value < 0 && (value & 0xffff8000) != 0xffff8000)) {
throw new TokenCompileError("Value can not fit in 16 bits", token);
}
} |
647de6f0-7bb0-4c9b-9027-d958b25d1fc9 | 1 | public static void insertEntreprise(int idville,String nom, String adresse1, String adresse2) throws SQLException {
String query;
try {
query = "INSERT INTO ENTREPRISE (ID_VILLE,ENTNOM,ENTADRESSE1,ENTADRESSE2) VALUES (?,?,?,?);";
PreparedStatement pStatement = ConnectionBDD.ge... |
44907deb-e2f3-43f6-b9a0-5f82e7f6da09 | 9 | public void ticRefreshSpace(int space)
{
if (space == 1) {
button1.setText("");
button1.setEnabled(true);
}
else if (space == 2) {
button2.setText("");
button2.setEnabled(true);
}
else if (space == 3) {
button3.setText("");
button3.setEnabled(true);
}
else if (spac... |
3e516733-59b6-4d3f-9288-c9ffa9ef5359 | 6 | static void processArgs(String args, Config config) {
String[] split = args.split(",\\s*");
for (String s : split) {
if (s.equals("debug")) {
DEBUG = true;
}
if (s.equals("tty")) {
config.setTty(true);
}
if (s.startsWith("context=")) {
CONTEXT = s.replace("context=", "");
}
if (s.eq... |
efb71eb7-c734-4649-815d-3a879882cd84 | 5 | public boolean hasText() {
for (Node child: childNodes) {
if (child instanceof TextNode) {
TextNode textNode = (TextNode) child;
if (!textNode.isBlank())
return true;
} else if (child instanceof Element) {
Element el = (... |
c80e9515-1047-4d65-bb64-6e940e432d25 | 2 | public void updateDB() {
if (succLogin) {
try {
openConnection();
st.execute("UPDATE Player SET Coins='" + coins + "' WHERE Name='" + user + "'");
st.execute("UPDATE Player SET Unlocked='" + unlocked + "' WHERE Name='" + user + "'");
st.execute("UPDATE Player SET Playtime='" + playtime + "' WHERE N... |
68aeb9c6-f9e7-443f-add4-bf763f319ddb | 2 | private boolean isClassInDir(File file)
{
String []files;
files = file.list();
for(int i=0; i< files.length; i++)
{
if(files[i].equals(this.className)) return true;
}
return false;
} |
abae512f-6dd8-425d-87da-769ef55a9394 | 4 | public void colision (int ancho, int alto){
//no dejo que bueno salga por la derecha
if (this.getPosX() + this.getAncho() >= ancho) {
this.setPosX(ancho - this.getAncho());
}
//no dejo que bueno salga por izquierda
else if (this.getPosX() <= ancho/2) {
th... |
e57e6c29-a7e3-46e8-aea6-db48357e3800 | 0 | @Override
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column
) {
return this;
} |
cdd75410-f6ce-43dd-af5b-25c04786297c | 0 | public static void end() {
Printer.printToConsole("End");
Printer.printToConsole(String.format("%d Victims killed", killedVictims));
Printer.printToConsole(String.format("%d Victims spawned", spawnedVictims));
Printer.printToConsole(String.format("Victims in pool %d", Initialization.numb... |
40474520-1f00-42a5-a2f6-ed62b1f963bf | 2 | public static String lcp(String v, String w) {
int n = Math.min(v.length(), w.length());
for (int i = 0; i < n; i++) {
if (v.charAt(i) != w.charAt(i)) return v.substring(0, i);
}
return v.substring(0, n);
} |
69357832-0627-4b7e-b367-54924dd634f6 | 3 | public float getAttackBonus(Point p) {
float bonus = 0;
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
if (placeable != null) {
bonus += placeable.getAttackB... |
78945ef5-2672-4381-b319-f9710d956579 | 6 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
if (shadowNoneButton.getSelection ()) style |= SWT.SHADOW_NONE;
if (shadowOutButton.getSelection ()) style |= SWT.SHADOW_OUT;
if (leftButton.getSelectio... |
f17283e1-00a4-4b8a-bf5a-19f1b8094daa | 9 | private void replace(Node seNode,HashSet<String> names,HashSet<Integer> excludedIds,Associator assoc){
Iterator<String> it = names.iterator();
String seName = seNode.getName();
SynSE oldSE = null;
SynSE se = ses.get(seName);
while(it.hasNext()){
String name = it.next();
while(replacedSEs.contai... |
e9f87b1a-9f1b-40ae-8ce0-19b0a4b72eff | 5 | private void createGUIComponents() {
CardTreeNode treeRoot = new CardTreeNode(Main.CARDS);
cardsTree = new JTree(treeRoot);
cardsTree.setRootVisible(false);
cardsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
cardsTree.addTreeSelectionListen... |
b5655375-04e9-4ca3-a77f-0e04567b2eda | 7 | @Override
public void remove(T t) {
DInfo<T> op;
SearchReturnValues ret;
LockFreeNode<T> newNode=new LockFreeNode<T>(t);//node to find
while(true){
ret=search(newNode);
if(newNode.compareTo(ret.l)!=0){
//In case something change during the search and
// we miss the element, we try it again one ... |
0c82d147-4ead-4558-8485-0c47581c3283 | 6 | private static void addSettersClass(Class<?> cls) {
List<FastMethod> setters = new ArrayList<FastMethod>();
classToSetters.put(cls, setters);
FastClass fastClass = FastClass.create(cls);
while (cls != null) {
for (Method method : cls.getDeclaredMethods()) {
in... |
dd20aa2e-88df-45a8-ac0e-54d4549cd6f4 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(msg.tool()==this)
&&(requiresAmmunition())
&&(ammunitionCapacity()>0))
{
if(ammunitionRemaining()>ammunitionCapacity())
... |
9774289f-03c4-444d-9303-ee6afc722ab5 | 4 | @Override
protected void onAction(String sender, String login, String hostname, String target, String action)
{
super.onAction(sender, login, hostname, target, action);
int i = 0;
while(true)
{
Main.debug("Action check: " + serverid + " - " + Main.gui.tabs.get(i).serverid, false);
if(Main.gui.tabs.get(... |
e90dba45-099c-4efa-aef0-38744eec5727 | 5 | @Test
public void testReadyStateTransition() throws ProcessExecutionException, ProcessRollbackException {
IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true);
assertTrue(comp.getState() == ProcessState.READY);
// test valid operation
TestUtil.setState(comp, ProcessState.READY);
try {
c... |
9a569916-da3c-4e3c-804c-d0ad25320f56 | 5 | private int parseOption(String option) {
if(option.equals("1")) {
return MAKE_CELL_ALIVE;
}
else if (option.equals("2")) {
return NEXT_GENERATION;
}
else if (option.equals("3")) {
return UNDO;
... |
b8a0b0e8-a667-4494-8497-e817286e8fb5 | 0 | @Override
public void componentResized(ComponentEvent arg0) {
HEIGHT = this.getHeight();
WIDTH = this.getWidth();
resize();
} |
6626b6ae-329c-4726-a65d-8b5c725830fe | 6 | public void add(Integer k, Integer v) {
int nHeight = 1;
Node<Integer, Integer> x = root, y = null;
while (x != null) {
int cmp = k.compareTo(x.key);
if (cmp == 0) {
x.value = v;
return;
} else {
y = x;
... |
01b13797-af7a-4c96-9a1e-20732a4e8155 | 4 | public static void main(String[] args) throws IOException {
// parse arguments
if (args.length == 0 || args.length > 2)
usage();
boolean recursive = false;
int dirArg = 0;
if (args[0].equals("-r")) {
if (args.length < 2)
usage();
recursive = true;
dirArg++;
}
//TODO Configurations to be a... |
bae0152c-8c5d-40ee-be4f-b73305823539 | 9 | public void generateDataforCassandra(int uID, int noOfReplicas,
int noOfSamples, int rate) { // to measure Cassandra replicating
// performance
int tsID = 0;
long executedTime = 0;
// String test = "";
try {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date date = new... |
26a770dd-f507-4912-87b9-eb82013b5ca4 | 4 | public static void main(String[] args) {
try {
// Creating a server
ServerSocket theConnection;
theConnection = new ServerSocket(5001);
// A new socket to pick up the "request"
Socket theConversation;
theConversation = theConnection.accept();
// We create a reader on this socket as well as a writ... |
21337cc5-a928-48fd-a87c-a4bcd2dfe6e6 | 7 | protected void addMissing(Instances data, int level,
boolean attributeMissing, boolean classMissing,
int attrIndex) {
int classIndex = data.classIndex();
Random random = new Random(1);
for (int i = 0; i < data.numInstances(); i++) {
Instance current = data.instance(i);
for (i... |
cdd40b7a-e8a3-421f-a714-13a3917887d5 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if (getValueAt(0, column) == null) {
return String.class;
}
returnValue = getValueAt(0, column).getClass();
} else {
... |
84f029cd-412d-4d28-b772-b3a8c5dc7ed6 | 0 | public AbstractTestLinkRunListener(final T testLinkRunListener) {
this.inTestLinkListener = testLinkRunListener;
} |
ef2cde2a-f11e-499c-a823-81a387232068 | 3 | @Override
public void execute(double t) {
if (hist != null && input.isConnected()) {
Matrix u = input.getInput();
hist.store(u, t);
double v = u.norm1();
if (v > maxv)
maxv = v;
}
} |
e62298a0-2f90-4cde-9336-4ef78478585f | 1 | public static void main(String[] args){
f = new FrameManager();
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setResizable(false);
f.setSize(width, height);
f.setTitle("Nightmare");
f.setLocationRelativeTo(null);
Image icon;
try {
icon = ImageIO.read(WindowManager.class.ge... |
db1dfd5e-6f09-4579-a5b0-b07430c03e6b | 7 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Funcionario f = new Funcionario();
if (!(txCodigo.getText().equals("")) || (txCodigo.getText().equals(null))){
f.setId_funcionario(Integer.parseInt(txCodigo.getText()));
}
... |
5b4ec32b-5391-4fba-9549-9b623e747bec | 5 | public static void saveBubbleDiagram(File file)
{
try {
PrintWriter writer = new PrintWriter(file);
writer.println("Bubbles:");
for(Bubble bubble : Main.flowChart.getBubbles())
{
Point loc = bubble.getLocation();
writer.println("bubble:"+bubble.getId()+":"+loc.x+":"+loc.y+":"+bubble.getRadius... |
8069d99f-bfe3-44f3-adaf-7e198d67eefd | 5 | @SuppressWarnings("rawtypes")
public static SingleColumnComparator createDoubleComparator(NumberName numberName, boolean ascending, String defaultString) throws Exception
{
final String type="double";
if (ascending)
{
if (defaultString.equals(""))
{
return new SingleColumnComparator(... |
53f2d611-7ff4-4a39-92e2-a216e273af7b | 8 | @Test
public void testAsteroidVelocityInfluencedByGameSpeed() {
ArrayList<Asteroid> astX = new ArrayList<Asteroid>();
ArrayList<Asteroid> astY = new ArrayList<Asteroid>();
p.setGameSpeed(1.2);
for (int i = 0; i < 20; i++) {
p.spawnAsteroids();
}
for (Aster... |
79b3f4f2-1811-4fd6-a3c5-597f65970041 | 1 | public void removeShadow(Player player)
{
for (Castle c: player.getCastles()) {
core.Point p = p2o.get(c);
player.removeShadowRadius(p.x, p.y, 3);
}
} |
e79fa5ac-e37f-4cf7-a297-5dc80fdddc8c | 0 | @Override
public void deactivateFrame(JInternalFrame f) {
//System.out.println("deactivateFrame");
super.deactivateFrame(f);
} |
ddd9c636-e8c3-4525-86c4-7787c6a79cfb | 4 | public void btnConfirmarAgendamento() {
facesContext = FacesContext.getCurrentInstance();
Solicitacoes solicitacao = solicitacaoSelecionada.getSolicitacao();
solicitacao.setSol_status("Autorizado");
autorizar.setAut_data_horaAtual(new Timestamp(System.currentTimeMillis()));
autorizar.setAut_profAgen... |
61cc8dc6-1582-4f82-bda6-ceaccd2afc06 | 4 | public static String authenticateToken(String username, String token)
throws SQLException {
String auth_pass = getPassword(username);
String plain_token = UserServices.decrypt(token,
UserServices.generateKeys(auth_pass));
Statement statement = mysqlDB.createStatement();
ResultSet result = statement
.... |
2821ff04-e1fd-42bc-bb20-279c62143b41 | 5 | public static void main(String[] args) {
DWT _dwt = new DWT();
/* ----------------- Test for zigzag --------------------*/
double[][] _input = {{49, 61, 69, 61, 78, 89, 100, 112}
, {68, 60, 51, 42, 62, 69, 80, 89}
, {90, 81, 58, 49, 69, 72... |
0bba4d0b-ecf3-4503-83c7-e7f25c3e6e35 | 1 | @Override
public void draw(Pixel pixel, SinglePlayerGame game, Graphics g) {
MortalEntity entity = (MortalEntity) game.getEntity(pixel.x, pixel.y);
if (entity != null) {
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
Color c = Color.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.