method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dab0cb31-1559-45f0-8b33-0730a2bd4905 | 2 | public void setRef5(String ref) {
if (ref != null && ref.length() > 256)
throw new IllegalArgumentException("Ref cannot be longer than 256 characters!");
this.ref5 = ref;
} |
511b245e-2e55-49ff-80b8-6f0f76eab6fb | 9 | public static void complementaryGraph(mxAnalysisGraph aGraph)
{
ArrayList<ArrayList<mxCell>> oldConnections = new ArrayList<ArrayList<mxCell>>();
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
//replicate the edge connections in oldConnections
Object[] vertices = aGraph.getChild... |
90a3e5dd-1a0c-4201-85c9-59ed5da1d45e | 0 | public void setAuther(String auther) {
this.auther = auther;
} |
3e7cf548-32b7-4f28-b507-b834bb553ab9 | 5 | public void run(){
System.out.println("DownloadQueueProcessor Running");
while(parent.getRunning()){ //make sure program is still running
while(parent.queue.isEmpty()){
try {
Thread.sleep(TIME_SLEEP_IF_EMPTY); //if DL Queue is empty, pause for half a second before trying again
} catch (InterruptedE... |
d29b0039-47c0-495d-a518-8c94d0e9257f | 0 | public void setData(int newData)
{
data = newData;
} |
ebbaf58d-c5c4-490a-8679-add8afb82f5a | 7 | private void wilidingBattleResolution() {
if(playerChoices.getWildingsCard().equals("PreemptiveRaid") && ((BiddingAgainstWild)model.getBidding()).victory()){
Family winFamily=model.getBidding().getTrack()[0];
model.preemptiveRaid(winFamily);
if(getSeatNum()!=winFamily.getPlayer()){
playerChoices.bidding(... |
af5e45fc-95d7-4225-94ae-c1cf6fd7fcf5 | 0 | public void setPrenom(String prenom) {
this.prenom = prenom;
} |
505b5b22-8c6d-4cac-84e4-609baa4aa8f9 | 0 | CarItf deserializeFromJson(String json) {
AutoBean<CarItf> bean = AutoBeanCodex.decode(factory, CarItf.class, json);
return bean.as();
} |
257f5a28-b234-47a7-be0a-ba7f460ec28f | 5 | @Override
public void importScan(NessusClientData scan) {
PreparedStatement pstmt = null;
try {
String scanUuid = UUID.randomUUID().toString();
pstmt = connection.prepareStatement("INSERT INTO scans (UUID, NAME) VALUES(?,?)");
pstmt.setString(1, scanUuid);
pstmt.setString(2, scan.getPolicy().getName()... |
b57233bf-6350-4557-935c-ffb3e12f759c | 1 | private String getLastResponse() throws Exception {
if ( !formValues.containsKey(LAST_RESPONSE_KEY) )
throw new Exception("Last response was not found.");
return formValues.get(LAST_RESPONSE_KEY);
} |
52867002-ff50-469c-919c-ce8d28a63314 | 0 | public FSAAction(String string, Icon icon) {
super(string, icon);
} |
de6ec309-db5a-442c-af2b-1648c139104a | 0 | private void startButtonclick() {
view.startServer.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
view.startServer.setEnabled(false);
server.startServer(view.portText.getText());
}
});
} |
c5fdf87e-cc2b-41c7-99c5-73c53b2e69b3 | 3 | private synchronized void checkGridletCompletion()
{
ResGridlet obj = null;
int i = 0;
// NOTE: This one should stay as it is since gridletFinish()
// will modify the content of this list if a Gridlet has finished.
// Can't use iterator since it will cause an exception
... |
64c6af55-1251-4d59-9131-a009ba56ec1e | 2 | private void leerCoches(){
ArrayList<String> list = disco.leerArchivo("coches/coches");
String[] aux;
for(int i=0; i<list.size(); ++i){
aux = list.get(i).split("\t");
if(!cjtClientes.containsKey(aux[5])) aux[5]="-NA-";
else cjtClientes.get(aux[5]).addCoche(aux... |
29ef631b-8c99-4de5-9abe-f7a3e6712d74 | 4 | public String execute( String input ) {
try {
return (String) ( this.proMethod.invoke( this.executor.newInstance(), input));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace... |
750c354e-3ac3-4a93-803a-15ca3c3bd44b | 0 | public Object peek() {
return getFirst();
} |
5ce69f1e-3ff8-4cb8-81aa-49eee1e9832f | 9 | private static boolean isEmptyOrWhitespace(final String target) {
if (target == null) {
return true;
}
final int targetLen = target.length();
if (targetLen == 0) {
return true;
}
final char c0 = target.charAt(0);
if ((c0 >= 'a' && c0 <= 'z'... |
0f2ddd0a-120f-4115-a014-090571364a81 | 5 | public void asignarColumnaLetrasA(String nombreRespuesta, int numeroRespuesta){
switch(numeroRespuesta){
case 0: _jlbl1.setText(nombreRespuesta);
break;
case 1: _jlbl2.setText(nombreRespuesta);
break;
case 2: _jlbl3.setText(nombreRespuesta);
... |
7621232a-c5a9-4824-a51a-8d5c9ac94c34 | 1 | @Override
public long spawnBoss(String bossData) {
super.spawnBoss(bossData);
GameActor a = Application.get().getLogic().createActor(bossData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
pc.setLocation(x + 100, y + Display.getHeight() + 200);
... |
94f5b55f-0bfa-4b00-a8a8-9df487d60ec6 | 7 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
HashMap<String, String> map = new HashMap<String, String>();
d: do {
line = br.readLine();
if (line.length() ==... |
65f0b14e-7682-400b-bd96-acf969367bc1 | 9 | private FlowToken readNextTokenTextMode() throws SnuggleParseException {
/* Look at first character to decide what type of token we're going to read.
*
* NB: If adding any trigger characters to the switch below, then you'll need to add
* them to {@link #readNextSimpleTextParaMode()} ... |
243bf644-d179-49ee-8741-04356f895561 | 4 | public int[] agileCarMove(int x, int y, Direction direction, Car movingCar) {
//Precondition: direction != null; movingCar != null; x & y are coordinates on the map
//Postcondition: returns int[] with 2 elements which has coordinates on the map
int returnX, returnY;
int[] tmpInt = direction.moveRight();
re... |
328ea47d-5332-46e4-9121-1644867958e8 | 7 | @Override
protected void initCentroids(int k) {
final int size = this.docs.size();
final Random rand = new Random();
final Double firstCendroid = rand.nextDouble() * size;
this.centroids.add(firstCendroid.intValue());
Map<Integer, Double> distances;
Double distanceSum;
for (int i = 0; i < k - 1; i++) {
... |
6e3a89e0-5cde-49d2-b8f2-1dc8cbaa2c67 | 6 | @SuppressWarnings("deprecation")
private void processDirectoryRequest(OMMSolicitedItemEvent event)
{
System.out.println(_instanceName + " Received Directory request");
OMMMsg msg = event.getMsg();
Token token = event.getRequestToken();
int msgType = msg.getMsgType();
sw... |
f41a3e16-547d-4cfb-88b9-d07aef8af3cd | 3 | @SuppressWarnings("unchecked")
public ArrayList<Integer> getCorrectChoiceIndexes() {
ArrayList<Integer> indexList = new ArrayList<Integer>();
ArrayList<String> questionList = (ArrayList<String>) question;
ArrayList<String> answerList = (ArrayList<String>) answer;
for (int i = 1; i < questionList.size(); i++)
... |
54f7f8e5-15a1-42a5-9c15-e62f10a69ad2 | 8 | public String getContentType(File file) {
String fileName = file.getName();
String contentType;
if (fileName.endsWith(".htm") || fileName.endsWith(".html"))
contentType = "text/html";
else if (fileName.endsWith(".jpg") || fileName.endsWith(".jpeg"))
contentType = ... |
05eee7bf-10b4-433f-b850-960b32bc582f | 4 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher dispatcher = request.getRequestDispatcher(VIEW);
//een boolean om te controleren of de testCookie aanwezig is
boolean testCookieTest = false;
//nagaan of er wel cookies... |
1773e855-1c2d-4e9c-af16-2b6b4424dac3 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Section other = (Section) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))... |
81c67901-3736-423e-a7de-074b46a6150b | 5 | private void utters(Actor a, String s) {
boolean picked = false ;
for (Dialogue d : sides()) {
if (BaseUI.isPicked(d.actor())) picked = true ;
}
if (! picked) return ;
final Actor opposite = a == actor ? other : actor ;
final boolean onRight = onRight(a, opposite) ;
final int side = on... |
cb3c965b-8155-4527-b379-c75dac747ca7 | 9 | static Map<Package, List<Class<?>>> categorize(Collection<Class<?>> comp) {
Map<Package, List<Class<?>>> packages = new HashMap<Package, List<Class<?>>>();
for (Class<?> c : comp) {
Package p = c.getPackage();
List<Class<?>> tos = packages.get(p);
... |
fc819db7-82b9-4ef5-a6c7-cef571c8c0a9 | 2 | public void add(String word) {
char[] wordChars = word.toCharArray();
for (int i = 0; i < wordChars.length; i++) {
char before = wordChars[i];
wordChars[i] = (char) 0;
String key = String.valueOf(wordChars);
HashSet<String> valueSe... |
597fa1f9-1fd1-4c85-bee4-0adbc671556f | 5 | @Override
public int indexOf(Object o) {
// TODO Auto-generated method stub
if (o == null) {
for (int i = 0; i < size(); i++)
if (get(i)==null)
return i;
} else {
for (int i = 0; i < size(); i++)
if (((String)o).equalsIgnoreCase(ge... |
20de951d-57b7-48d7-846c-ecfbf50b89b7 | 6 | public void listMouseClicked(MouseEvent e)
{
if(e.getClickCount() == 2)
{
ArrayList<GeometricObject> temp;
if(mytabbedpane.getSelectedIndex()==0)
{
temp=geomListleft;
}
else
{
temp=geomListright;
}
switch (list.getSelectedValue())
{
case "Kreis" : temp.add(new Kreis(1, 1... |
3a5502c3-cd2c-430d-aeb1-49b7dac145f5 | 0 | public static void setFileBase(FileDataBase data){
fileBase = data;
} |
115ddaf0-90c2-47dd-bd58-62263c402a71 | 5 | private int calculateNextOrderIndex() {
int followingOrderIndex = 0;
for (List<QualifiedValue<?>> vals : fields.values()) {
for (QualifiedValue<?> val : vals) {
if (val.getOrderIndex() >= followingOrderIndex) {
followingOrderIndex = val.getOrderIndex() + 1... |
789b6d4e-d593-4ab4-ada5-652b8c6b0e35 | 6 | public void computeRoutingTables(int iterations,boolean splitHorizon){
String msg = "Calculating "+iterations+" iteration(s).";
if(splitHorizon){
msg += "\nSplit Horizon enabled.";
}
else {
msg += "\nSplit Horizon disabled.";
}
System.out.println(msg);
for(int i=0;i<iterations;i++){
... |
c9f6956d-c8d3-4e3c-b784-765d3575b4f2 | 1 | public ArrayList<Handler> getHandlersList() throws ClassNotFoundException, IllegalAccessException, InstantiationException, IOException {
ArrayList<Handler> outList = new ArrayList<Handler>();
Gson json = new Gson();
JsonReader jReader = new JsonReader(jFileReader);
ArrayList<String> hand... |
a2167425-df8e-4297-a43c-ed7f628a3b04 | 3 | public Email Abrir(int id){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM emails WHERE id = ? AND ativo = 1");
comando.setInt(1, id);
ResultSet consulta = comando.executeQuery();
comando.getConnection().co... |
7cdebc03-6b47-41ac-8a53-bc2237cfe27b | 3 | public static String[] getMaps() {
File file = new File(CFG.DIR, "maps");
if (!file.exists() || !file.isDirectory()) {
file.delete();
file.mkdir();
}
String[] names = new String[file.list().length];
for (int i = 0; i < names.length; i++) {
names[i] = file.list()[i].substring(0, file.list()[i].last... |
fd99b3c5-e96d-49a9-b171-941144097f60 | 0 | public void push(E element) {
stack.insert(element);
} |
0dbd488c-e54d-4bc0-8e19-351718a7f4f7 | 9 | @Override
public void insert(String value)
{
// Keeps track if the value has a collision.
boolean collisioned = false;
// Gets rid of the values that are not words.
if (value == null || !value.matches("^[a-zA-Z]+$"))
return;
int hashVal = hashFunc(value);
// Iterate over the items until an openi... |
be2f005d-de94-46db-91a6-66c82518054b | 5 | public void combination(List<Integer> list,int[] candidates,int index, int target ){
if(target <= 0){
if(target == 0){
result.add(new ArrayList<Integer>(list));
}
return;
}
for(int i =index; i < candidates.length;i++){
if(i > 1 && c... |
791f8b61-1d54-46c3-a610-7ce75869d7dd | 0 | public String toString() {
return "valve1 = " + valve1 + " " + "valve2 = " + valve2 + " "
+ "valve3 = " + valve3 + " " + "valve4 = " + valve4 + "\n"
+ "i = " + i + " " + "f = " + f + " " + "source = " + source;
} |
9247b10e-7aa0-411d-916c-2c9abf251a9f | 3 | public void disconnect() {
boolean disconnected = false;
synchronized(CONNECTION_LOCK) {
if(isConnected) {
logger.fine("Disconnecting from " + serverAddress + ":" + serverPort);
disconnectQuietly();
disconnected = true;
}
else if(isAttemptingToConnect) {
logger.fine("Cancelling connect requ... |
89cb8258-5e9c-4bda-9b6d-048dc90be0b8 | 4 | public void setOption( String op, String val )
{
if( op.equals( "lblAlign" ) )
{ // ctr, l, r
if( val.equals( "ctr" ) )
{
at = 2;
}
else if( val.equals( "l" ) )
{
at = 1;
}
else
{
at = 3;
}
}
else if( op.equals( "lblOffset" ) )
{ // 0-100
wOffset = (sho... |
d05fc5b0-4bf0-4ba0-8f01-8a7d9322e012 | 8 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String userId = request.getParameter("userId");
String groupId = request.getParameter("groupId");
Mongo mongo = new Mon... |
3d6b9e20-ff58-4116-b1b1-3b2d5a09bcd6 | 4 | private void initJoyStick(){
stick = new Joystick(screen, Vector2f.ZERO, (int)(screen.getWidth()/6)) {
@Override
public void onUpdate(float tpf, float deltaX, float deltaY) {
float dzVal = .2f; // Dead zone threshold
if (deltaX < -dzVal) {
stateManager.getState(Inter... |
c53d18ca-2e69-44b5-92e1-c06649098aa2 | 1 | @Override
public void draw(Graphics page)
{
shipImage.drawImage(page, xLocation, yLocation);//Draws the plane on the component
//Draws the collision Border
if(this.getBorderVisibility())
{
drawCollisionBorder(page,xLocation,yLocation,shipImage.getWidth(),shipImage.getHeight());
}
} |
eb4da94f-7b9b-4249-88d3-e67fea60150c | 9 | public static void main(String [] args) throws FileNotFoundException
{
//Read in all the possible data points into the arrayList that will hold them
ArrayList<DataPoint> d = new ArrayList<DataPoint>();
Scanner s = new Scanner(new File("bitvals.txt"));
//int i = 0;
//p vals are bitvals all of which are collated int... |
8d9da374-b11d-4eb6-9aa7-8b7cde8a047e | 0 | public static void main(String[] args) {
long[]arr = new long[]{2,3,4};
arr[0] = 1;
System.out.println(arr[0]);
System.out.println(arr[1]);
System.out.println(arr[2]);
System.out.println(arr[3]);
} |
1dfde07e-1746-4c21-bd0e-fb6af50ac513 | 4 | public static String readFile(String path){
//System.out.println("path : " + path + " reading...");
String sCurrentLine;
String sJSON = "";
BufferedReader bReader = null;
try{
FileReader fReader = new FileReader(path);
bReader = new BufferedReader(fReader,16000);
while ((sCurrentLine = bReader.readLine()) != nu... |
a250436d-dcad-47b4-8000-669259e4250b | 5 | private boolean boardIsFull()
{
for (int x=0; x < boardWidth; x++)
{
for (int y=0; y < boardWidth; y++)
{
if (sudokuTextFields[y][x].getText() == null || sudokuTextFields[y][x].getText().isEmpty() || boardVals[y][x] == NULL_VAL)
return false;
}
}
return true;
} |
288faa98-f8ea-4f72-8d5e-29a2b2df08aa | 0 | public void close(){
this.vue.setVisible(false);
} |
830eea0b-195a-4049-99ae-4c569ad56c84 | 9 | private void enableUpdater() {
if(config.getBoolean("Updater.check-for-updates")) {
Updater updater = new Updater(this, 55348, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false);
if(config.getBoolean("Updater.notify-console")) {
if(updater.getResult() == UpdateResult.NO_UPDATE)
console.sendMessag... |
6a23f195-12a4-4330-868b-e25f0052dbb6 | 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... |
27d41215-bffe-4dca-8fae-561d2c3cfc70 | 3 | private void addCall(final Instruction inst, final int kind) {
final MemberRef method = (MemberRef) inst.operand();
final Type type = method.nameAndType().type();
final Type[] paramTypes = type.paramTypes();
final Expr[] params = new Expr[paramTypes.length];
for (int i = paramTypes.length - 1; i >= 0; i--) ... |
c2afb4cc-f50e-43e6-9713-69211f1b3bec | 0 | public int[] sort() {
int length;
length = array.length;
this.tempMergArr = new int[length];
doMergeSort(0, length - 1);
return array;
} |
5f461ad1-490d-4092-b9d6-f03b4178eb02 | 0 | private static ImageProcessor yGradient(ImageProcessor ip){
ImageProcessor result = ip.duplicate();
int[] Gy = {-1, -2, -1, 0, 0, 0, 1, 2, 1};
result.convolve3x3(Gy);
return result;
} |
d5f4f04c-6356-469a-99d8-fe02fa8bcdfa | 5 | public Map<String,String> toParameterMap()
{
Map<String,String> parameters = new LinkedHashMap<String,String>();
parameters.put("merchant_id",getMerchantId());
if (GoCoin.hasValue(getStatus()))
{
parameters.put("status",getStatus());
}
if (GoCoin.hasValue(getStartTs()))
{
param... |
0e6e546e-76de-4d4a-9021-11de1782804d | 4 | @Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.sin(value.getDouble())));
}
if (val... |
882003e2-005d-4f26-93bf-0706bc32b9a9 | 4 | private static Line below(LinkedList<Line> tLines, Line l) {
int index = -1;
for (Line l0 : tLines) {
if (l0 == l) {
index = tLines.indexOf(l);
break;
}
}
if (index < tLines.size() - 1) {
return tLines.get(index + 1);
... |
2a2ccf77-d26c-4d29-98cc-fd56435b8e0d | 8 | public void parseMethod(Parser parser, CompilationUnitDeclaration unit) {
//connect method bodies
if (unit.ignoreMethodBodies)
return;
//members
if (this.memberTypes != null) {
int length = this.memberTypes.length;
for (int i = 0; i < length; i++)
this.memberTypes[i].parseMethod(parser, unit);
}
//meth... |
c2ff4e57-fbb7-4a37-9a03-6da96f8adc6b | 1 | @Override
public void recieveEvent(Event event) {
if(event.getEventType() == EventType.OUTPUT) {
String text = (String) event.getData();
voice.speak(text);
}
// System.out.println(this.getClass().toString() + " recieved event:");
// System.out.println(event);
... |
20046a3b-5a4b-423b-8b23-8adb399345e6 | 4 | public static void main(String[] args) throws Exception {
MakeHandsOns prog = new MakeHandsOns();
if (args.length == 0) {
System.err.printf("Usage: %s directory [...]%n", MakeHandsOns.class.getSimpleName());
} else if (args[0].equals("-h")) {
doHelp();
} else
for (String arg : args) {
if (".".equals(... |
877b01d5-80c0-4415-beea-efaf43ae2586 | 7 | public String [] getOptions() {
String [] options = new String [12];
int current = 0;
if (m_unpruned) {
options[current++] = "-U";
}
if (m_reducedErrorPruning) {
options[current++] = "-R";
}
if (m_binarySplits) {
options[current++] = "-B";
}
options[current++] = "... |
0c9c253d-d443-4b83-8bee-912172afa889 | 6 | private void punizione(CalcioPiazzato a){
a.tipo="punizione";
match.scout.addTiro(a.team);
Giocatore p=null;//portiere
//selezione tiratore e portiere
if(a.team.equals("casa")){
a.tiratore=match.getCasa().getRigorista();
p=match.getOspiti().getGiocatore(Ruolo.GK).get(0);
}else{
a.tira... |
7dda485c-e000-49a6-85b1-aaa2ad94ff0d | 3 | @Override
public void execute(double t) {
Matrix data = new ColumnMatrix(output.getDim());
if (input.isConnected() && input.getSource() != null) {
data = input.getInput();
}
try {
output.setOutput(data);
} catch (OrderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
5ed2189f-98d1-4ae0-ae1f-080c39c029df | 3 | public static void main(String[] args) {
try {
BrickGame.path = args[0];
Master.setConfig();
FieldGame.init_sub(10, 8);
Status.ifWin = -1;
BrickGame.error = new String[2];
BrickGame.error[0] = "fatal";
BrickGame.error[1] = "writeproblem";
String[] names = new String[4];
names[0]="Test1";
... |
68a32263-29a2-406b-bab0-a26598316c65 | 0 | public void setWarmerPlateStatus(int status) {
this.warmerPlateStatus = status;
} |
ac2c0b04-3c8f-4ddf-bef4-869dac76f08e | 6 | public void drawCircuit(String output, String output_file)
{
GraphViz gv = new GraphViz();
gv.addln(gv.start_graph());
gv.addln("rankdir=LR;");
String[] lines = output.split("\n");
int max_lines = lines.length;
Matcher matcher = Pattern.compile("STATES_NO:([0-9]+)").matcher(
lines[0]);
matcher.find()... |
1a51f0db-4a43-4ed2-a893-231f21abc594 | 5 | private void movePlayer(){
if(!inside){
checkCollisionsOut();
}else{
checkCollisionIn();
}
playerRect.x += xDirection;
playerRect.y += yDirection;
playerLeft.x += xDirection;
playerLeft.y += yDirection;
playerRight.x += xDirection;
playerRight.y += yDirection;
playerTop.x += xDirection;
play... |
7856ef4d-fc24-4980-991e-d1cfe004fa34 | 7 | public static void main(String[] args) {
Primes primes = new Primes();
ConsecPrimeSum s = new ConsecPrimeSum();
ArrayList<Integer> list = new ArrayList<>();
//System.out.println(s.primeSumBelow(1000000));
//List<Integer> list = primes.getPrimes(1000000);
long num = 0;
long largestConsec = 2;
boolean b... |
7b246a61-bb6c-45e2-b137-eaf59dd9488a | 5 | protected int backfillGridlets() {
int nStarted = 0;
if(jobOrder != null) {
Collections.sort(waitingJobs, jobOrder);
}
Iterator<SSGridlet> it = waitingJobs.iterator();
while(it.hasNext()) {
SSGridlet gl = it.next();
if(gl.getStartTime() > 0) {
continue;
... |
3fcd81fc-a7c7-4805-8533-e0edfea0b495 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return Object.class;
returnValue = getValueAt(0, column).getClass();
... |
498161f0-8b14-4050-b396-c577f2ccf390 | 3 | public static void print(Object obj) {
Class<?> c = obj.getClass();
if (!c.isArray()) {
return;
}
System.out.println("\nArray length: " + Array.getLength(obj));
for (int i = 0; i < Array.getLength(obj); i++) {
System.out.print(Array.get(obj, i) + " ");
}
} |
cad19692-173a-49ed-88c1-fcd351497338 | 9 | public String createSQL() throws SQLException {
String returnValue = "select ";
String where = "";
boolean first = true;
for (Field field : getXmlline().getFields()) {
if (!field.isUse())
continue;
if (first) {
first = false;
returnValue += field.getName();
}... |
74f0e4c0-7d5f-405c-8064-75cf37424558 | 2 | public boolean hasStatistics()
{
for (StatMethod m : methods)
{
if (m.invocations != 0)
{
return true;
}
}
return false;
} |
be6668b5-8f9b-427a-87f3-9f65d3f7a040 | 5 | private void jButtonCompresserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCompresserActionPerformed
if (!this.jTextFieldNameFile.getText().isEmpty() && !this.jTextAreaChaineACompresser.getText().isEmpty())
{
JOptionPane d = new JOptionPane();
d.showM... |
8b9d710f-1416-41f5-8fe1-c701a49fe1e5 | 5 | @Override public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s==Save) {
Game.map.parse.encode(Game.edit.mapname);
}
else if (s==Load) {
new LoadMap();
}
else if (s==Change) {
ValidateMapSize(Integer.parseInt(Height.getText()),Integer.parseInt(Width.getText()));
ValidateMa... |
763d217d-eff6-4bf5-9d8b-6880d1ca486d | 3 | void removePredecessor(Instruction pred) {
/* Hopefully it doesn't matter if this is slow */
int predLength = preds.length;
if (predLength == 1) {
if (preds[0] != pred)
throw new alterrs.jode.AssertError(
"removing not existing predecessor");
preds = null;
} else {
Instruction[] newPreds = ne... |
e32e8c22-dbf9-4a97-82b4-53d4adbbc6f8 | 7 | public Image getCompoundTerrainImage(TileType type, double scale) {
// Currently used for hills and mountains
Image terrainImage = getTerrainImage(type, 0, 0, scale);
Image overlayImage = getOverlayImage(type, 0, 0, scale);
Image forestImage = type.isForested() ? getForestImage(type, sca... |
92ab1cf8-4d00-4dcf-ad5a-c1d9ea1ccb5b | 9 | private void addItemOkPressed(String itemName, String itemPrice, String itemQuantity) {
StringBuffer errorMessage = new StringBuffer();
double price = 0.0;
int quantity = 0;
boolean nameValid = false;
boolean priceValid = false;
boolean quantityValid = false;
nam... |
e484a8be-8d7a-4b9a-998a-72747d2361a3 | 7 | public void analyze(Reader input, Writer output) throws IOException {
Analyzer analyzer = Morfeusz.getInstance().getAnalyzer();
int words = 0;
long start = System.currentTimeMillis();
StreamTokenizer tokenizer = new StreamTokenizer(input);
int token;
whi... |
ca2ade4f-946f-4f02-9585-627ce4fa6c3e | 3 | public boolean getPlayerName(String josh) {
try {
FileInputStream fStream = new FileInputStream("playernames.txt");
DataInputStream in = new DataInputStream(fStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
if (line.... |
3cadccf3-3e51-48fa-9067-676b024c82dd | 9 | public boolean setParameterString(String paramString)
{
try
{
int i = Integer.parseInt(paramString);
if (i < 1) {
return false;
}
setTimes(i);
this.random = false;
return true;
}
catch (NumberFormatException localNumberFormatException1)
{
try
... |
5756528a-ea71-4aff-a5e9-8f37aa7598ea | 8 | public void doEmote(Tickable ticking, String emote)
{
MOB emoter=null;
emote=CMStrings.replaceAll(emote,"$p",ticking.name());
emote=CMStrings.replaceAll(emote,"$P",ticking.name());
if(ticking instanceof Area)
{
emoter=CMClass.getMOB("StdMOB");
emoter.setName(ticking.name());
emoter.charStats().setSt... |
8b0f2eb9-f23f-425a-bb72-999f8f4f5719 | 6 | private void LogInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogInButtonActionPerformed
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:VideoStore", "", "");
Statement stat = con.create... |
05f720b4-a642-47be-8d96-b3a8973123a9 | 5 | private void setGameOverMessage() {
long formattedScore = (long) (mPlayer.getScore() - mPlayer.getScore() % 5);
String text = "GAME OVER! Level: " + mLevel + ", Score: " + formattedScore + ". ";
if (mLevel < 6) {
text += "Keep practicing!";
} else if (mLevel < 12) {
... |
b9ec6fd3-f163-4c90-b941-2d7fa9c5f901 | 8 | public void ponerPrimerFicha() {
int tlt = Domino.listaTablero.size();
while (true) {
for (int i = 0; i < Domino.listaFichaPc.size(); i++) {
if (Domino.listaFichaPc.get(i).getCabeza() == Domino.listaTablero.get(0).getCola()) {
Domino.listaFichaPc = mst.ad... |
66f98c25-54a0-4438-9f58-c7803ebea7bc | 9 | public Histogram getGaussianSmoothed(double standardDeviation) {
if(standardDeviation < 0.0) {
throw new IllegalArgumentException(JaiI18N.getString("Histogram8"));
} else if(standardDeviation == 0.0) {
return this;
}
// Create a new, identical but empty Histogram... |
faba1821-7bc3-457a-811f-7d93c3e4872e | 1 | public Simulation(String[] config, boolean verbose)
{
//set the output Person file
outPerson = new OutputFile("personCreated.txt");
//set the output BusStop file
outBusStop = new OutputFile("busstopCreated.txt");
//set the output Person file
outBus = new OutputFile("b... |
dd499550-01f3-4f60-b0f1-93136f5dec0c | 5 | public void writeToAdjacencyMatrix(String file){
int[][] A = new int[network.size()][network.size()];
for(Node N:network)
{
for(int i=0;i<N.getDegree();i++)
{
A[N.id][N.getNeighbour(i).id] = 1;
}
}
try
{
Buff... |
aa765f0d-e58c-4715-bf51-e0236213e416 | 3 | @Override
public long computeCostOfAllocation(BaseInterval<Integer> allocation) {
long cost = 0;
// next walk thgrought edges and compute for all new added occurrences
for (ValuedInterval<Integer, IntervalMultimap.MultimapEdge<Occurrence>> valuedInterval : this.solution.allocations... |
8a5b3473-e711-4e19-9f41-8bec6357c4f2 | 4 | public void sellTower(int x, int y) {
if (map.getTile(x, y).getTower() != null) {
Tower t = map.getTile(x, y).getTower();
towerList.remove(t);
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
map.getTile(t.getTileX() + i, t.getTi... |
31061f72-5a81-47c5-a47b-900ad7c7c15a | 3 | public DefaultComboBoxModel<String> buildVariableModel() {
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/variables"));
String line;
while((line = reader.r... |
20b7e0cd-43b5-4862-b139-132b2a3a44b1 | 8 | public void check_random(RandomNumberGenerator generator, int seed)
{
// set the seed of the random number generator
generator.set_seed(seed);
clear_histogram();
// test odd/even of numbers
// test average number
for (int i = 0; i < this.max_size; i++) {
int value = generator.next_int... |
83c48201-43a6-4561-befe-ff2813785431 | 8 | public SettingsHandler(final GenericTestMonitorApplication application, final PreselectionPanel preselectionPanel) {
_application = application;
final String kvPid = _application.getConnection().getLocalConfigurationAuthority().getPid();
_preferences = Preferences.userRoot().node("/gtm").node(kvPid); // durch An... |
a715eabb-a9c8-4858-9ab6-fe5c8b8947af | 0 | protected Iterator configKeys() {
return props.keySet().iterator();
} |
5e2953ea-1b56-4b1e-b30a-26de22b233a0 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
{
Player player = (Player)sender;
if (command.getLabel().toLowerCase().equals("favor"))
{
if (player.hasPermission("favordisfavor.favor") || player.isOp())
{
this.fdInterface.favor(args[0]);
... |
8fc3e143-05a6-43e3-9eb9-1bf42c473cec | 9 | private static void render(String s)
{
if (s.equals("{"))
{
buf_.append("\n");
indent();
buf_.append(s);
_n_ = _n_ + 2;
buf_.append("\n");
indent();
}
else if (s.equals("(") || s.equals("["))
buf_.append(s);
else if (s.equals(")") || s.equals("]"))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.