method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9ad1c878-c811-42b6-bd17-4db86610167f | 2 | public static Interlocuteur selectByIdCommercial(int id) throws SQLException {
String query = null;
Interlocuteur interlocuteur1 = new Interlocuteur();
ResultSet resultat;
try {
query = "SELECT * from INTERLOCUTEUR where ID_COMMERCIAL =? ";
PreparedStatement pS... |
dcd134ff-df49-4601-9930-179ee0640edc | 9 | public String toString(){
String toString = "";
if(pointGuard1 != null){
toString = "PG: "+ pointGuard1.getName();
}
else {toString = toString+"PG: None ";}
if(pointGuard2 != null){
toString = toString + " PG: "+pointGuard2.getName();
}
else {toString = toString+" PG: None ";}
if(shootingGuar... |
5fc902ae-7dee-4f99-9875-714f9da58583 | 8 | public void ping()
{
if(camera != null && timer.milliTime() > PING_TIME)
{
int x = 0;
int y = 0;
if(getX() > camera.getX() + camera.getWidth())
x = camera.getX() + camera.getWidth();
else if(getX() < camera.getX())
x = camera.getX();
else
x = getX();
if(getY() > camera.getY() ... |
4c614c8e-7bb6-420f-ad28-74a586b27895 | 9 | public boolean isSym(TreeNode n1,TreeNode n2){
if(n1==null&&n2==null){
return true;
}else if((n1==null&&n2!=null) || (n1!=null&&n2==null)){
return false;
}else{
if(n1.val==n2.val&&isSym(n1.left, n2.right)&&isSym(n1.right,n2.left)){
return true;
}
return false;
}
} |
88e90b50-c94b-45ee-bb72-7a0a508a3e47 | 6 | public static boolean haveConversation(Option... options) {
final TimedCondition stop = new TimedCondition(20000) {
@Override
public boolean isDone() {
return !isOpen() && !Widgets.canContinue();
}
};
while (stop.isRunning()) {
if (Widgets.canContinue()) {
final WidgetChild cont = Widgets.getC... |
75579071-a5af-44b8-a81b-9280964d8c0d | 0 | public void setCountry(String country) {
this.country.set(country);
} |
ef449ded-6f17-4455-90ef-5fb229b8999e | 6 | boolean contains( Fragment f )
{
for ( int i=0;i<rows.size();i++ )
{
Row r = rows.get(i);
if ( r.cells.size()==1 )
{
FragList fl = r.cells.get( 0 );
if ( fl.fragments.size()==1 )
{
Atom a = fl.fra... |
aef1f508-e39d-44e9-bdc0-d2f54be8d50a | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "DataReference", scope = ReferenceList.class)
public JAXBElement<ReferenceType> createReferenceListDataReference(ReferenceType value) {
return new JAXBElement<ReferenceType>(_ReferenceListDataReference_QNAME, ReferenceType.class, Refere... |
73595889-a6e6-499c-8275-325fea8c73e8 | 6 | @EventHandler
public void GiantJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Jump.DodgeCha... |
d01d8bed-2316-45ce-b66b-2e0caacaca1f | 0 | public void addArmForce(int armForce) {
this.armForce += armForce;
} |
0aca8923-13fe-49a4-93a7-253fa9ac48b2 | 4 | public void triangulate (FaceList newFaces, double minArea)
{
HalfEdge hedge;
if (numVertices() < 4)
{ return;
}
Vertex v0 = he0.head();
Face prevFace = null;
hedge = he0.next;
HalfEdge oppPrev = hedge.opposite;
Face face0 = null;
for (hedge=hedge.next; hedge!=he0.prev; ... |
2f9f4e12-2cf2-4eb2-bea6-e2c1f51d38c4 | 4 | private void checkColors() {
for (int i = 1; i < 7; i++) {
switch (labels[i].getText()) {
case "2771":
labels[i].setBackground(Color.DARK_GRAY);
break;
case "":
labels[i].setBackground(Color.BLACK);
... |
377472e1-5124-4fa8-8df4-731469332287 | 3 | @EventHandler(ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
// hide any hidden players from them
// but only if they can't see everyone anyway
if(PermissionsManager.playerHasPermission(player, "vanish.seeall")) {
return;
}
// get all our onl... |
e5badcf1-e5d2-4003-bf69-7c405cb484f9 | 9 | @Override
protected Point2D calculateControl(GObject target, Context context) {
// Create variables to check for horizontal and vertical movement.
int horizontal = 0;
int vertical = 0;
// Check the context for relevant keys.
for (Integer i : context.getKeyCodesPressed()) {
// Check the code.
if (i.eq... |
083223f7-db65-4b4e-a0f8-a712ae8fc5be | 1 | public float getFloat( String name ){
XAttribute attribute = getAttribute( name );
if( attribute == null )
throw new XException( "no attribute known with name: " + name );
return attribute.getFloat();
} |
72ea94b0-1f2e-4c1b-bcf5-092bfa389d97 | 6 | private BufferedImage createTile(int tile){
int sheetWidth = sheet.getWidth()/width;
int yOrigin = tile / sheetWidth;
int xOrigin = tile % sheetWidth;
if(xOrigin<sheet.getWidth()&&yOrigin<sheet.getHeight()){
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
for (int x = ... |
b4e29152-55a3-4026-a416-452f0a7c7afe | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
f29531a6-47d0-433f-9047-fd802734dc2e | 3 | public List<Mapping> getMappings(Literal selectLiteral) {
List<Mapping> result = new ArrayList<>();
//for(Literal literal: view.literals){
int[] positions = viewPositions.get(selectLiteral.id);
if(positions==null)
return result;
for (int i = positions[0]; i < position... |
40f7ecb9-b9e4-4c18-8b71-105c350b6c1b | 1 | @Override
public Connection crearConexion() {
try {
InitialContext initialContext=new InitialContext();
DataSource dataSource=(DataSource) initialContext.lookup("java:comp/env/jdbc/" + Conexion.getDatabaseName());
Connection connection=dataSource.getConnection();
... |
6fc44dbf-4d46-4a14-a800-fbe2efa08b8b | 3 | public void insertPlace() {
ServletContext context = getServletContext();
InputStream is = context.getResourceAsStream("/WEB-INF/places-sample.csv");
BufferedReader br;
try {
String l="";
boolean isHeader = true;
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while((l=br.readL... |
d7dac818-6c62-4bcf-9b5f-2df81dda040f | 6 | public String request_from_api(String data){
try {
if(this.debug){
this.MCAC.logger.log("Sending request!");
}
final URL url = new URL("http://api.crashcraft.co.uk/" + this.MCAC.APIKey);
final URLConnection conn = url.openConnection();
conn.setConnectTimeout(5000);
conn.setRead... |
efb7b8b3-2aea-438c-b5fc-868305ddb917 | 8 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 175
// setlimit, line 176
v_1 = limit - cursor;
// tomark, line 176
... |
74c14cfa-a77f-4ec5-87e1-eac737dfbcc0 | 5 | public static LinkedList<Integer[]> listaTorol( LinkedList<Integer[]> lista, Integer[] parok )
{
LinkedList<Integer[]> ujLista = new LinkedList<Integer[]>();
for( Integer[] i : lista )
{
int j=0;
for( j=0; j<6; j++ )
{
if( i[j] != parok[j] )
break;
}
if(j == 6)
ujLista.add(i);
}... |
e4521e86-3da0-4bbf-a6b1-ac1b7c01ea2b | 1 | private static IParameters parseParameters(String[] args) throws IOException {
IParameters parameters;
if (args.length != 0) {
parameters = new ConsoleParameters(args);
} else {
String currentDir = System.getProperty("user.dir") + "\\";
File propertiesFile = n... |
ad4140aa-9102-4d09-a953-cf0be875468c | 6 | private static byte[] scanKeyFile(CryptobyConsole console) {
scanner = new Scanner(System.in);
byte[] tempKey = null;
do {
System.out.println("\nAllowed Key Sizes 128,192 and 256 Bit.");
System.out.println("Enter Path to Key File (Type '" + quit + "' to Escape):");
... |
e85c11d1-7d06-4bec-ac9c-ed3ace1e77a5 | 6 | public List validate() {
String error;
if(!isNameValidate()) {
error = "Name is not valid.";
validateErrors.add(error);
}
if(!isSurnameValidate()) {
error = "Surname is not valid.";
validateErrors.add(error);
}
if(!isBirt... |
bf77c8e6-ce26-45b3-919e-d4b3260ec43c | 8 | private void setLinear() throws Exception {
//then set default behaviour for node.
//set linear regression combined with attribute filter
//find the attributes used for splitting.
boolean[] attributeList = new boolean[m_training.numAttributes()];
for (int noa = 0; noa < m_training.n... |
0c02da14-9562-4be4-9f7e-b99f8e288ffd | 8 | @Override
public void sourceConfInit(FlowProcess<JobConf> flowProcess,
Tap<JobConf, RecordReader, OutputCollector> tap, JobConf conf) {
conf.setInputFormat(AccumuloInputFormat.class);
setFields(TapType.SOURCE);
AccumuloTap accumuloTap = (AccumuloTap) tap;
if (false == ... |
32c83990-b8e4-48d4-becd-e5043daa6419 | 6 | public void update(GameContainer gc, int delta, BlockMap bmap)throws SlickException
{
Vector2f trans = new Vector2f(0,0);
Input input = gc.getInput();
if(input.isKeyDown(Input.KEY_W))
{
trans.y -= 0.5f * delta;
}
if(input.isKeyDo... |
bdaf7dd8-afcd-460c-b0a6-0e231968c609 | 3 | public void setVar(PVar node)
{
if(this._var_ != null)
{
this._var_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
74d8d77d-2f36-4863-bfaf-176571f45b91 | 8 | public void adaptSegments(boolean positiveReinforcement){
//NO WAY to remove synapses added to segment
//find a method to replace low perm synapses with new comer
if(segmentUpdateList.size()>0){
for(SegmentUpdate sUpdate : segmentUpdateList){
//System.out.print(sUpdate.updateSegment.synapses.size()+"-"+sUp... |
7f3fbaa9-656a-4ce2-8bea-1ccd583f9d34 | 2 | public static void main(String[] args)
{
Frame frame = new Frame();
frame.setSize(width, height);
frame.setDefaultCloseOperation(3); //3 = Exit_ON_CLOSE
frame.setLocationRelativeTo(null);
frame.setResizable(false);
// frame.setUndecorated(true);
frame.setVisible(true);
frame.makscreen();
long ... |
fa117224-1848-4f9a-a0db-6db1a081ff13 | 3 | @Override
public void mousePressed(MouseEvent e) {
cancelDrag = false;
if (e.getComponent() == map) {
xPress = e.getX()* map.getResizeConstant();
yPress = e.getY()* map.getResizeConstant();
xPressLocal = map.getPress().x + (map.getRelease().x - map.getPress().x)*x... |
a2cff66c-b89d-4132-9df4-827f6801d0e7 | 7 | public var_type mod(var_type rhs) throws SyntaxError{
var_type v = new var_type();
keyword returnType = getPromotionForBinaryOp(v_type, rhs.v_type);
if(isNumber() && rhs.isNumber()){
if(returnType == keyword.DOUBLE || returnType == keyword.FLOAT){
sntx_err("mod uses integral types only");
}
if(rhs.va... |
2e5301d7-041a-4d75-9263-780021c5e275 | 9 | public static void main(String args[]){
if (args[0].equals("-r")){
int cycles = Integer.parseInt(args[1]);
int rounds = args.length == 3 ? ROUNDS : Integer.parseInt(args[2]);
int actLen = args.length == 3 ? Integer.parseInt(args[2]) : Integer.parseInt(args[3]);
runRandom(cycles, rounds, actLen);
}
els... |
ec344463-149d-4118-b91b-33640aec8b18 | 5 | public Case choixCase(){
Case c;
Scanner console = new Scanner(System.in);
System.out.println("Entrez l'abscisse de la case");
int a,b;
try{
a = Integer.parseInt(console.nextLine());
} catch (NumberFormatException e) {
a = -1;
}
Sys... |
aac96fd2-f2b4-4e62-9b13-9f7b323ad8d7 | 2 | private int readTypeSpecTable
(ResTable_TypeSpec typeSpecTable,
byte[] data,
int offset) throws IOException {
typeSpecTable.id = readUInt8(data, offset);
offset += 1;
typeSpecTable.res0 = readUInt8(data, offset);
offset += 1;
if (typeSpecTable.res0 != 0)
throw new RuntimeException("File format ... |
adf05b20-abee-4f09-8e55-a0ee38f5d76d | 8 | private int maxValue(int[][] grid, int depth, int alpha, int beta)
{
//check if the board is in a terminal (winning) state and
//return the maximum or minimum utility value (255 - depth or
//0 + depth) if the max player or min player is winning.
int winner = checkForWinner(grid);
if ( winner != GV.PLAYER_EM... |
521252d9-79b3-4ad0-84a5-806f4aefcd80 | 0 | @Override
public Balance Accesscreate() {
return Balance.create();
} |
134c7c54-9947-4f35-842d-b84758ea1e8f | 8 | public String commandTOP(String arguments) {
// Splits the input down to the message number and number of lines.
String[] argSplit = (arguments + " ").split(" ", 2);
String msgs = (argSplit[0].toUpperCase()).trim();
String ns = (argSplit[1]).trim();
int msg = convertStrToInt(ms... |
06abf87c-8631-487f-b5f6-27e77c7fc2b7 | 4 | public void addMethod(CtMethod m) throws CannotCompileException {
checkModify();
if (m.getDeclaringClass() != this)
throw new CannotCompileException("bad declaring class");
int mod = m.getModifiers();
if ((getModifiers() & Modifier.INTERFACE) != 0) {
m.setModifie... |
32618acd-3013-4c9d-9c4d-f1827a2a13a8 | 5 | private static double[] getSupportPoints(int curvePoints,int lineNumber, double[] lowPrices) {
double[] sPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 999999999;
for(int j=-(curvePoints);j<=0;j++){
if((i+j>=0) && (i+j<lineNum... |
93ffe09b-d374-44e2-ab2b-e9df0da3b924 | 6 | private Collection<ITask> getRemoverTasks(Collection<ITask> availableTasks, Person person, SimulationMap map) {
Collection<ITask> removers = new ArrayList<>();
Set<String> states = person.getState();
for(ITask t: availableTasks){
if(t.getType().equals("Cleanup") && t.itemsExist(perso... |
72cfd5cb-2f9a-43d8-87ba-d57e6073ccfa | 9 | public Object get(String atrName) {
Object ret = null;
if (atrName.equals(LABEL)) {
ret = v.getLabel();
} else if (atrName.equals(SHAPE)) {
ret = v.getShape();
} else if (atrName.equals(BORDER)) {
ret = v.getShapeStroke();
} else if (atrName.eq... |
0634c577-8c34-4233-b5cd-d81dd99b9dbb | 8 | @Test
public void testCheckTutChoices(){
//Initialize a boolean saying there are no students who have no first choices and aren't flagged.
boolean startEmptyFirstChoices = true;
//For each student
for(Student s: students){
//If a student has no first choices and isn't flagged
if(s.getFirstChoiceTuts().is... |
d2a8a3c5-455d-4f8c-877d-638a91d7d0b4 | 3 | public void setZoom(float zoom) {
if (zoom > this.max_zoom || zoom < this.min_zoom)
return;
if (this.zoomElement) {
this.taille_noeud = taille_noeud / this.zoom * zoom;
this.decalage_passage = decalage_passage / this.zoom * zoom;
this.largeur_chausse = largeur_chausse / this.zoom * zoom;
this.larg_pa... |
9fd50266-7050-4148-acf5-2258aa6e71e1 | 2 | public Object getJsonFromFile(Class<?> type) throws IOException {
Gson gson = new Gson();
Object jsonObject = null;
InputStream stream = this.getClass().getClassLoader()
.getResourceAsStream(getPath());
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(stream));
... |
bac0c772-1a64-41b8-9edd-41893424ac9a | 7 | protected String read_zigzag(char[][] block, int[] num_key,boolean row)
{
StringBuilder sb=new StringBuilder();
if(row)
{
for(int i=1;i<=num_key.length;i++)
{
int pos=Generic_Func.search_index(num_key, i, 0);
for(int j=0;j<block[pos].length;j++)
{
if(block[pos][j]!='\0')
sb.append(bl... |
4bc3f715-0dfe-4ea4-a618-112feb0b230e | 5 | public int storeAnnotation(Annotation anno) {
int result = 0;
ResultSet rs = null;
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("insert into Annotations (TicketID_FK, WorkerID_FK, Annotation, CreatedOn) values (?,?,?,?)", Statement.RETURN_GENERATED_KEYS);
statement.se... |
de458b88-3dcb-4802-99ed-7e16522b7387 | 2 | private Parameter createGroup(int contextParameter, List<Type> types, List<Annotation[]> annotationsList, List<Field> fields,
Class groupType, Method methodType)
{
List<Parameter> parameters = new ArrayList<>();
int posList = 0;
for (int i = contextParamete... |
31db86b9-b8f5-4798-9c18-cc55cb290888 | 2 | private Move_Two processInput(String xmlString) {
//goal is to convert XML representation, embedded
//in xmlString, to instance of move object. Ideally
//this could be done auto-magically, but these technologies
//are heavyweight and not particularly robust. A nice
//compromise i... |
b8cdc0b8-e48f-4bb3-9e90-b3846fcef209 | 7 | public static void bubbleSortImproved(int[] a){
System.out.println("Array before sorting");
for(int i:a)
System.out.print(i+" ");
System.out.println();
System.out.println("Sorting sequences after each iteration");
int n=a.length;
boolean swapped=true;
for(int i=0;i<n&&sw... |
163732b4-e922-44fe-994e-52f7a8669f8f | 1 | public void test_LocalDate_toDateMidnight_Turk() {
LocalDate date = new LocalDate(2007, 4, 1);
try {
date.toDateMidnight(MOCK_TURK);
fail();
} catch (IllegalInstantException ex) {
assertEquals(true, ex.getMessage().startsWith("Illegal instant due to time zone ... |
38fc8a08-592b-4e8a-96cc-f967f81a9fd5 | 8 | public static String decrypt (String str) {
byte[] keyMac = OSUtils.getMacAddress();
byte[] keyHardware = OSUtils.getHardwareID();
String s;
try {
Cipher aes = Cipher.getInstance("AES");
if (keyHardware != null && keyHardware.length > 0) {
try {
... |
0ffba9a1-e4d1-45e5-828d-8166e1d1a1ec | 2 | private void nextLevel() {
resetLevel();
if(nextLevel.startsWith("b")){
getKarpfenGame().setLvl(new BossLevel(nextLevel, getKarpfenGame()));
}else if(nextLevel.startsWith("s")){
getKarpfenGame().setStory(new Storyline(nextLevel, getKarpfenGame()));
}else{
getKarpfenGame().setLvl(new Level(nextLevel, karp... |
4bbf0e17-da8c-4d48-9369-083adee41daa | 3 | public static int[] heapSort(int[] array) {
if(array == null || array.length <= 1) {
return array;
}
buildMaxHeap(array);
for(int heapSize = array.length; heapSize > 1; heapSize--) {
swap(array, 0, heapSize - 1);
maxHeapify(array, 0, heapSize - 1);
}
return array;
} |
3e470bbe-0297-45b8-b66b-57cc936f34cb | 5 | public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
cp.newUTF8("Synthetic");
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
cp.newUTF8("Deprecated");
}
cp.newUTF8(na... |
91ef14a8-4d72-49ad-bb10-126bc15332b2 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
ffed2bb7-8757-462f-964d-367d710326be | 9 | public static IXMLFormatter getXMLFormatter(Class toClass)
{
if (g_oFormatters == null)
{
g_oFormatters = new HashTable<Class, IXMLFormatter>();
}
if (g_oFormatters.containsKey(toClass))
{
return g_oFormatters.get(toClass);
}
// Need ... |
9517469d-5d1a-46ca-8dfa-5a639729844b | 4 | public Puzzle findSolution()
{
iterativeLogicSolve();
printPuzzle();
if(getTruthState()==1)
{
return this;
}
else if(getTruthState()==-1)
{
return null;
}
else
{
Cell c = this.getChoice();
... |
01b759ce-462c-4228-a9d1-1e637ec2f061 | 0 | public void setTempFileManagerFactory(TempFileManagerFactory tempFileManagerFactory) {
this.tempFileManagerFactory = tempFileManagerFactory;
} |
de2d51f5-7c84-4077-b5e0-9e782258c58f | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
among_var = find_among_b(a_5, 19);
if (among_var == 0)
... |
e158aa6b-e31d-4b95-a6f1-7d032a3caf20 | 6 | public static int partition(int[] a, int low, int high)
{
int i = low;
int j = high + 1;
int point = a[low];
while(true)
{
while( less(a[++i], point) )
{
if(i == high)
break;
}
while( less(point, a[--j]) )
{
if(j == low)
break;
}
if(i >= j)
break;
exc... |
f4abcb66-2de7-4d12-90ae-b555aa78115c | 5 | public void assignBehaviour(Behaviour behaviour) {
if (behaviour == null) I.complain("CANNOT ASSIGN NULL BEHAVIOUR.") ;
if (updatesVerbose) I.sayAbout(actor, "Assigning behaviour "+behaviour) ;
actor.assignAction(null) ;
final Behaviour replaced = rootBehaviour() ;
cancelBehaviour(replaced) ;
pu... |
4624145a-84f4-4971-a4cd-64a5f23ac335 | 4 | public static void Unread(String hostmask)
{
for(String s : Prefixes){ if(s.split(" ")[0].equalsIgnoreCase(hostmask)) Prefixes.remove(s); }
for(String s : Suffixes){ if(s.split(" ")[0].equalsIgnoreCase(hostmask)) Suffixes.remove(s); }
} |
cd68bb1e-81fe-4665-9177-e7bf764b4e4c | 0 | public void startListening() {
listening = true;
Thread thread = new Thread(this);
thread.start();
} |
2213ec75-cce7-48fa-b3c0-b320c80b5516 | 7 | public void readBdn(File inFile, File outFile) {
boolean pngToBmp = true;
long lasting = System.currentTimeMillis();
File inParentDirectory = inFile.getParentFile();
File outParentDirectory = outFile.getParentFile();
if (!inParentDirectory.isDirectory()) {
System.out.println("inParentDirectory: " + inPare... |
cdfa8ad1-1f67-4bda-bb8f-efe7e5f4ce93 | 1 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
getStageManager().close();
}
} |
d64aacdc-9ffa-4b0f-bae0-788c095ba65b | 3 | @Override
public void separateOperands() {
operandArray = new ArrayList<String>();
instructionArray = new ArrayList<String>();
for (int i = 0; i < programString.size(); i++) {
if (programString.get(i).contains("DATA")) { //Only operand declarations contain this String sequence
operandArray.add(pro... |
9cc0e88a-e446-471e-9cf2-64ab22cbe1af | 9 | private void calcWindow()
{
// get current dims
width = getWidth();
height = getHeight();
// do some checks to see if we need a new draw buffer
if(buf == null
|| width < buf.getWidth() - 40
|| width > buf.getWidth()
|| height < buf.getHeight() - 40
|| height > buf.getHeight()
){
buf = new... |
ceb885c3-de19-4f38-bfc2-ab06460d6b33 | 4 | @Override
public void actionPerformed(ActionEvent ae)
{
for (Updatable u : updatables)
{
if (u == null)
continue;
//When game is paused only update PlayerInput
if (gameIsPaused && u.getClass() != PlayerInput.class)
continue;
... |
e4b9629d-52a2-493a-9ac1-898c38c6eba8 | 7 | private void layTrack() {
int[] next = null;
switch (buildDir) {
case "N":
next = coaster.nextTrack(1);
break;
case "E":
next = coaster.nextTrack(2);
break;
case "S":
next = coaster.nextTr... |
130e0ad8-1835-4219-8976-5d776b4b133d | 1 | public boolean bonusPeutAttaquer(Territoire from, Territoire to){
if( to.estEnBordure() )
return true;
return false;
} |
04340bf0-9403-4c89-b7ab-a7862224eaf1 | 1 | @Override
public void makeVisible(boolean v) {
for(IScreenItem item : screenItems) {
item.setVisible(v);
}
} |
374e01b3-d3be-4443-8df7-49647040d4ba | 7 | public StringBuilder sub(StringBuilder aValue, String MaxForSub) {
while (aValue.length() > MaxForSub.length()) {
//fills up 0's if value got more numbers
MaxForSub = "0" + MaxForSub;
}
for (int i = aValue.length(); i >= 1; i--) {
if (MaxForSub.charAt(i - 1) > aValue.... |
cf119234-f487-4ebc-8099-923348ab2e40 | 3 | public static void refreshNYMSList() {
System.out.println("IN refreshNYMSList");
((NYMTableModel) jTable_NymsList.getModel()).setValue(new NYM().loadNYM(), jTable_NymsList);
nymMap = new NYM().loadNYM();
String serverID = "ALL";
if (serverMap != null && serverMap.size() > 0 &... |
71070688-b49e-47b1-b4bd-6aaff85f4376 | 0 | public float getDiscount() {
return discount;
} |
365ba8cf-6820-473f-be37-d9df1d4c4c8b | 9 | public void update(GoldRushApplet app, Mine m) {
if (Collision(m)) {
app.ir.goldcount += currentgold;
currentgold = 0;
x = ux;
y = uy;
if (!(lives - 1 < 0)) {
lives--;
}
if (lives == 0) {
... |
10642115-8e76-469c-b08c-3e74faca803a | 5 | public static String stripWhitespace(String str) {
char[] from = str.toCharArray();
char[] to = new char[from.length];
int t = 0;
for (char c : from) {
if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) {
to[t++] = c;
}
}
retur... |
884997a5-ac6b-457a-84be-00005230a6f6 | 5 | public HashMap<Integer, String[]> sort( File f ) throws IOException{
BufferedReader br = new BufferedReader( new FileReader(f) );
HashMap<Integer, String[]> out = new HashMap<Integer, String[]>();
int c;
int bracket = (int) '>';
int newline = (int) '\n';
int flag = 0;
... |
4fb53feb-c58a-46f5-91b9-9dd4941b5b1d | 6 | private static int outcode(double pX, double pY, double rectX, double rectY, double rectWidth, double rectHeight) {
int out = 0;
if (rectWidth <= 0) {
out |= OUT_LEFT | OUT_RIGHT;
} else if (pX < rectX) {
out |= OUT_LEFT;
} else if (pX > rectX + rectWidth) {
out |= OUT_RIGHT;
}
if (rectHeight <= 0)... |
735f33db-f96b-49ca-9f90-3069147cb94c | 2 | public static void CLASS(){
double i = Math.random();
if (i < 0.33)
System.out.println("Even though Damon slept through class, he obtained notes from his good friends Nan, Kevin, and David.");
else if (i < 0.66)
System.out.println("Damon slept through the class, but he somehow feels like he reached an epiph... |
ddf27b99-bc14-4725-9f48-ed30494f22de | 3 | public static void main(String[] args)
{
System.out.println("------- Some testing --------\n");
Test.jExec();
System.out.println("Program is on.\n");
try {
listeningSocket = new ServerSocket(portNumber);
while(true){
System.out.println("Waiting for a new client...\n");
Socket interactiveSocket... |
ba169bff-455b-44e0-83e5-19d43067ef02 | 5 | private synchronized void processRequest(Packet packet) {
if(packet == null) {
sendToClient(Packet.getIncorrectCommandPacket());
} else {
String code = packet.getCode();
if(code.equals(Packet.PACKET_COD... |
85b8078a-453d-4617-aabf-bd83b1689c34 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
ae9317ed-8b41-49c2-a4e6-8629aae7fc23 | 1 | public void remove(IHudItem hudItem) {
if (!hudItemQueue.remove(hudItem)) {
logger.info("tried to remove a hud item that didn't exist");
}
} |
4cb4cc77-8fac-465f-8bf5-f9beba7fcdbb | 1 | public void testNegated() {
Hours test = Hours.hours(12);
assertEquals(-12, test.negated().getHours());
assertEquals(12, test.getHours());
try {
Hours.MIN_VALUE.negated();
fail();
} catch (ArithmeticException ex) {
// expected
... |
3e25a71d-e676-4718-a3e8-b9a11fe32fce | 7 | @EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event) {
if (event.isCancelled())
return;
Block bl = event.getBlock();
Location loc = bl.getLocation();
if (bl.getType().equals(Material.ANVIL)) {
if (plugin.anvils.containsKey(loc)) {
ItemStack hand = event.getPl... |
8110f02e-5bcb-4f5e-8e70-827586e34dad | 4 | public boolean handleReleased(Point clickPoint) {
HUDArea hudArea = null;
boolean ret = false;
if(!shouldRender) {
return false;
}
if (isInside(clickPoint)) {
//start from the top and work our way down to "layer" the huds
for (int i =... |
c988af9d-be7c-4e05-ac1e-cb1f8cc99957 | 5 | public static byte getPrecedence(byte t) {
switch (t) {
case WATER:
return WATER_PRECEDENCE;
case GRASS:
return GRASS_PRECEDENCE;
case SNOW:
return SNOW_PRECEDENCE;
case SAVANNAH:
return SAVANNAH_PRECEDENCE;
case SAND_DESERT:
return SAND_DESERT_PRECEDENCE;
default:
return (by... |
2539d43f-591d-4b04-a8f2-56339bfad09f | 5 | public void getInput() throws IOException {
String command;
Scanner inFile = new Scanner(System.in);
do {
this.display(); // display the menu
// get command entered
command = inFile.nextLine();
... |
1afaba7f-6952-4e53-8b9b-8b7155fdf1b7 | 3 | protected static boolean withinGlobeQuandrant(double latitude, double longitude, double nLat, double sLat, double eLong, double wLong) {
return (latitude <= nLat && latitude >= sLat && longitude <= eLong && longitude >= wLong);
} |
8ccc371e-5312-4c5d-9650-e56fd7b3b767 | 1 | public Label getLabel() {
if (label == null) {
label = new Label();
}
return label;
} |
829f8a59-c8ba-4398-8dbf-8b59e01a6ea0 | 9 | public static List<String> split(String l, String sep, Boolean all) {
int nest = 0;
int lsep = sep.length();
ArrayList<String> returnValue = new ArrayList<String>();
if (l.equals("")) {
return returnValue;
}
for (int i = 0; i <= l.length() - lsep; i++) {
... |
6a9a454a-a0b4-4c1d-a42a-0771ce1a7a6d | 1 | public void testColumnNameCount() {
DataSet ds = null;
try {
final DelimitedColumnNamesInFile testDelimted = new DelimitedColumnNamesInFile();
ds = testDelimted.getDsForTest();
// check that we parsed in the right amount of column names
assertEquals(6, ... |
a62a6261-4df8-4da2-97a8-dad3dc47b263 | 9 | private double findStopFraction()
{
// We would like to walk the full length of centerToAff ...
double scale = 1;
stopper = -1;
// ... but one of the points in S might hinder us
for (int j = 0; j < size; ++j)
if (!support.isMember(j))
{
// Compute vector centerToPoint from cen... |
50d6803c-d2d7-42fa-88d2-ccce0e15744d | 0 | public void setProtocol(FileProtocol protocol) {
this.protocol = protocol;
setText(protocol.getName());
} |
c84be448-10fe-4899-a957-240c8202d44e | 2 | public static List<Utterance> segUtterances(List<Utterance> goldUtterances,
boolean dropStress) {
List<Utterance> segUtterances = new LinkedList<Utterance>();
for (Utterance utt : goldUtterances) {
Utterance segUtt = new Utterance(utt, false);
if (dropStress) {
segUtt.reduceStresses();
}
segUtter... |
778dcc3a-ab69-4d23-a30c-5121a8b5d35d | 5 | public void comandos(){
boolean sesion;
do{
sesion = false;
System.out.println(" ");
if(ManejadorAdministradores.getInstancia().getAdmin() != null){
System.out.print(ManejadorAdministradores.getInstancia().getAdmin().getNick()+">>");
sesion = true;
}else{
ManejadorMiembros.getInstancia().com... |
c20a8dd5-32fc-491b-8bd0-cc67f9506079 | 4 | public ArrayList<Course> getUnfulfilledCourseRequests(HashMap<String, Course> cs) {
ArrayList<Course> unfulfilledRequests = new ArrayList<Course>();
for (String courseKey : taf.getProcessedCourses()) {
boolean unfulfilled = true;
Course course = cs.get(courseKey);
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.