method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7ad3e832-b684-46ce-a895-2fcb2374bcd8 | 0 | public UnreachableStatesDetector(Automaton automaton) {
myAutomaton = automaton;
} |
99f9c271-4ae2-462d-a173-8eaa6e5b2b82 | 1 | private int sizeCalculate() {
if (nextElement == null) {
return 0;
} else {
return 1 + nextElement.sizeCalculate();
}
} |
002de6b7-3def-462c-b9bf-de8b59073524 | 6 | public void updateGui() {
// { Remove all components from the ModelPanel
for (JPanel constraintPanel : this.constraintPanels) {
constraintPanel.removeAll();
}
this.objfuncPanel.removeAll();
this.removeAll();
// }
// { GUI part for the objective-function
GuiUtil.addComponent(this, ... |
b6a0406c-14c1-4c7a-b5a1-989351a582cd | 8 | @Override
public void run() {
try {
final List<VanillaUser> users = new ArrayList<VanillaUser>();
final VanillaData data = new Gson().fromJson(Utils.getFileContent(vanillaData, null), VanillaData.class);
for(final VanillaUser vanillaUser : data.authenticationDatabase.values()) {
if(UsersManager.getUserB... |
455fffec-eb4b-42bc-9e7a-f1b258135f21 | 4 | public void setInventoryFromString(String text)
{
ItemStack items[];
try {
items = SerializationUtil.loadInventory(text);
} catch (InvalidConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
if(items == null)
{
return;
}
for (ItemStack item : item... |
e86ee416-e42b-410b-9728-e06b7d2a1fbf | 2 | public List<TableCart> readAll(Connection conn, TableCart bean){
String sql = "select * from cart ;";
PreparedStatement pstm = preparedStatementWrapper(conn, sql);
ResultSet rset = queryWrapper(pstm);
List<TableCart> result = rsetMapperWrapper(rset);
... |
b99c806f-2c65-4e68-8f28-ff395675b540 | 6 | public static void parse(String path){
if(!blockParse){
try {
Document doc = new SAXBuilder().build(new File(path));
Element root = doc.getRootElement();
Element framework = root.getChild("Framework");
Element custom = root.getChild("Custom");
if(framework == null) {
Main.fatalError("Corru... |
55ff454b-d516-4eac-a456-02e1efb6bfc0 | 5 | private void startEditors() {
JFrame frame = null;
if (this.inApplet) {
new URLMaker(this.getCodeBase());
} else {
new URLMaker(null);
}
Object[] supportedTools = { "State Table", "Truth Table", "Circuit Diagram" };
Object defaultTool = "State Table";
int result = JOptionPane.showOptionDialog(null,... |
de29b632-9e14-4fcd-82af-e4e1ca5b5186 | 6 | private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard... |
4ea0c574-c3fd-41cb-9da8-fa7771a719d9 | 9 | private List<Interval> calcIntervals() {
List<Interval> intervals = new ArrayList<Interval>(numIntervals);
// Gets collection max an min
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
for (double n : durations) {
max = Math.max(max, n);
min... |
3c7f7a0a-2180-40dc-a6f5-099518781b5e | 3 | public List<String> makeSortedList() throws Exception{
String line;
while((line = br.readLine()) != null){
if(!line.equals(null) && !line.equals("")){
add(line);
}
}
return strList;
} |
9490049f-f0a4-4516-abe6-3c10aed7f7da | 9 | protected Instance convertInstance(Instance instance) throws Exception {
Instance result;
double[] newVals;
Instance tempInst;
double cumulative;
int i;
int j;
double tempval;
int numAttsLowerBound;
newVals = new double[m_OutputNumAtts];
tempInst = (Instance) instanc... |
5a058751-6885-48e7-b309-f5e50e00c25d | 1 | public void printElement() {
System.out.print("GENERALIZATION : " + this.identifier + " SUBCLASSES : " );
for(String st : ident){
System.out.print(st + ", ");
}
} |
5de70959-f419-4ce7-8f9a-afe1ad041746 | 3 | void print(Node t, int n, boolean p)
{
if (p)
{
printLet(t, n);
}
else
{
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
System.out.println("(let ");
}
... |
1738ba59-ba0b-45a0-80a5-cecd4092614c | 9 | private void readData( ByteBuffer buf ) throws IOException
{
//read data
ISMatTag tag = new ISMatTag(buf);
switch ( tag.type )
{
case MatDataTypes.miCOMPRESSED:
long numOfBytes = tag.size;
//inflate and recur
if ( buf.remain... |
1f6e00d4-647e-4019-be5d-172942223684 | 1 | private long calc(String[] numbers) {
long sum=0;
for(String tmp:numbers){
String num=tmp.substring(0, 12);
sum+=Long.parseLong(num);
}
return sum;
} |
433b569e-e76d-4b8a-9e99-87f0c4a2d9d5 | 2 | public static ArrayList<String> dice(String s) {
ArrayList<String> out = new ArrayList<String>();
Matcher m = Pattern.compile(noteCat).matcher(s);
Pattern p = Pattern.compile(note);
while (m.find()) {
Matcher m1 = p.matcher(m.group());
if (m1.find())
... |
88c60faf-fd67-4efc-8d4f-99883008a61b | 8 | public static void loggedIn(Player player, int worldId) {
if (player.getPrivateChat() == 2) {
return;
}
for(World world : Worlds.getWorlds()) {
for(Player cyclePlayer : world.getPlayers()) {
for(String friend : cyclePlayer.getFriends().keySet()) {
if (friend != null) {
if (friend.equalsIgnore... |
0cce8a61-af46-4bd5-a25f-f95d96ee08ca | 1 | public void addUniform(String uniform)
{
int uniformLocation = glGetUniformLocation(program, uniform);
if(uniformLocation == 0xFFFFFFFF)
{
System.err.println("Error: Could not find uniform: " + uniform);
new Exception().printStackTrace();
System.exit(1);
}
uniforms.put(uniform, uniformLocation... |
959bdd18-0323-4ba9-bfb6-c6c2eb4c686f | 7 | public void placePiece(){
int randomInt = randomInt();
if(randomInt == 1){
piece = new Piece(randomInt, new Location(0,3), new Location(0,4), new Location(0,5), new Location(0,6), board,0);
}
else if(randomInt == 2){
piece = new Piece(randomInt, new Location(1,6),new Location(0,6),new Location(0,5),new Lo... |
4902a28c-abda-4c2b-8e1c-b432bceac779 | 7 | private void loopChildren(NodeList nodes) throws Exception{
for(int x=0; x<nodes.getLength(); x++){
Node node = nodes.item(x);
if(node.getNodeName().equals("AttributeGroupList")){
}
else if(node.getNodeName().equals("AttributeList")){
}
else if(node.getNodeName().equals("Classifications")... |
4efb44b3-ba08-4bbe-a1e1-fbcebdfb0398 | 3 | @Override
public Component getListCellRendererComponent(JList<? extends ICPBrasilTimeStamp> jlist, ICPBrasilTimeStamp e, int i, boolean bln, boolean bln1) {
ICPBrasilCertificate cert = null;
String label = null;
try {
cert = e.getSignerCertificate();
}
catch (Cert... |
634a6cbe-82ed-4237-8c1e-1dfc618ef74f | 2 | public InputStream getInputStream ()
{
if ("bulk" != getType () || !isInput ())
throw new IllegalArgumentException ();
spi = getDevice ().getSPI ();
return new BulkInputStream (spi, getEndpoint ());
} |
c32a398e-6da3-4463-b677-441bcefe85fc | 2 | public void actionPerformed(ActionEvent e)
{
timer.stop();
if (lastSecond) {
lastSecond = false;
player.playTrack(TrackType.TIMEOUT);
timer = new Timer(HURRY_UP, this);
timer.start();
} else {
for (Phantom phantom : phantoms) {
... |
c43a2f61-b0c6-4754-be47-5d963c289a40 | 3 | public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
4a82d1d1-0b79-4b44-810c-3351bf1f1a52 | 7 | private void createMine(int x, int y) {
int tempX, tempY;
do {
tempX = (int) (Math.random() * width);
tempY = (int) (Math.random() * height);
} while ((tempX == x - 1 || tempX == x || tempX == x + 1)
&& (tempY == y - 1 || tempY == y || tempY == y + 1)
|| mines[tempX][tempY] == -1);
mines[tempX][t... |
27de217a-5f40-4997-8da0-f78352815ee7 | 4 | private List<Integer> merge(List<Integer> left, List<Integer> right) {
List<Integer> sorted = new ArrayList<>();
int leftIdx = 0;
int rightIdx = 0;
for (int idx = 0; idx < left.size() + right.size(); ++idx) {
// the only tricky part of Merge Sort is this if condition
... |
d5587a81-d66c-461a-8f36-4bd9a10c1172 | 1 | @Test
public void filtersByAuthorFirstnameWorks() {
citations.add(c1);
filter.addFieldFilter("author", "Urho");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c1) && filtered.size() == 1);
} |
f1053b80-3f51-4eb9-b04c-9e1a02f11d62 | 1 | public void hoist() {
// Shorthand
JoeTree tree = hoistedNode.getTree();
tree.setRootNodeCommentState(newTreeCommentState);
hoistedNode.setHoisted(true);
// Prune things
hoistedNode.getParent().removeChild(hoistedNode);
hoistedNode.setDepthRecursively(-1);
tree.setRootNode(hoistedNode);
tree.... |
ff831175-4e2f-4234-8886-dc5f8c976744 | 5 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String userInput;
int point; // stores where "." is
int length; // stores length of the string.
int numbersToPoint;//units to point
double resultToPoint = 0, resultAfterPoint = 0, result; // stores results
Sy... |
e581ccef-9fed-43c2-93d3-531ea4852df1 | 1 | public static void main(String... args) {
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
for (int i = 0; i < byteBuffer.capacity(); i++) {
byteBuffer.put((byte) i);
}
ByteBuffer _bytebuffer = byteBuffer.asReadOnlyBuffer();
// _bytebuffer.put((byte)0); //java.nio.... |
f5576445-42f0-4022-8165-84d1aebe08d9 | 5 | @Override
public void drawShape(Graphics graphics) {
int xn, yn, xm, ym;
int xa, ya, xb, yb, xc, yc, xd, yd;
// xn and yn is the first point the user clicked
// xm and ym is the second point the user clicked
xn = super.getXi();
yn = super.getYi();
xm = super.... |
57d6d7d1-ff98-4d64-bdaa-7796b3f5e155 | 8 | private boolean check() {
if (N == 0) {
if (first != null) return false;
}
else if (N == 1) {
if (first == null) return false;
if (first.next != null) return false;
}
else {
if (first.next == null) return false;
}
... |
af31d0cc-fa77-4d28-849d-c1f5137c8c92 | 7 | private String composeCommand() {
outName = "result_" + System.currentTimeMillis() + ".tab";
StringBuffer buffer = new StringBuffer("DC -verb"); // Working with verbose output
// Add PDB-file name
buffer.append(" -pdb ");
buffer.append(pdbFile.getAbsolutePath());
// Add RDC input file name
buffer.a... |
533298e2-f835-44ad-9ef1-16766edd835c | 4 | public Player[] factionSelectMenu() throws IOException {
String[] choices = SQLBackend.getCompaniesNamesList();
Company[] companies = SQLBackend.getCompanies();
Player[] players = new Player[companies.length];
Boolean nonProperSelection;
int[] chosen = new int[companies.length];
for (int i = 0; i < ch... |
c51d8936-fe51-4134-9a44-71402bb4ff53 | 1 | public void loadThis() {
if ((access & Opcodes.ACC_STATIC) != 0) {
throw new IllegalStateException(
"no 'this' pointer within static method");
}
mv.visitVarInsn(Opcodes.ALOAD, 0);
} |
8cba985f-4aa8-43e7-b524-af41c43ed8e4 | 3 | public synchronized void gridletPause(int gridletId, int userId, boolean ack)
{
boolean status = false;
// find this Gridlet in the execution list
int found = gridletInExecList_.indexOf(gridletId, userId);
if (found >= 0)
{
// update Gridlets in execution list up... |
3b286c98-1650-43da-aefe-bf04c84d3e56 | 0 | public void clearEmpty() {
} |
5d00f0b0-713c-4f43-8d76-f6afedcd561b | 4 | @Override
public void onEnable() {
getServer().getPluginManager().registerEvents(hml, this);
this.warning = new File(this.getDataFolder(), "hotel.yml");
this.nw = YamlConfiguration.loadConfiguration(warning);
this.config = new File(this.getDataFolder(), "config.yml");
this.nc = YamlConfiguration.loadConfigur... |
e6638f90-8e1e-41a9-9ab9-4b78ae04ddf7 | 1 | public void solve(String calculation) {
double solution;
try {
calculation = replacePi(calculation);
calculation = replaceLogs(calculation);
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
... |
4cc7bb7b-91bb-4e7c-b863-6e8e96c91359 | 5 | public boolean intersects(WordSpan s) {
int sstart = s.getStart();
//either s's start is in this or this' start is in s
return this.contains(s) || s.contains(this) ||
getStart() <= sstart && sstart < getEnd() ||
sstart <= getStart() && getStart() < s.getEnd();
} |
4226f7ce-3cb4-400b-971f-9c025287fbd7 | 1 | public void addShort(final int i) {
if (ClassEditor.DEBUG) {
System.out.println(" " + codeLength + ": " + "short " + i);
}
addByte(i >>> 8);
addByte(i);
} |
fbb72909-b159-4809-9d34-765757a2fc36 | 5 | @Test
public void getSurplus() {
TopAthlete test = null;
TopAthlete test1 = null;
try {
test = new TopAthlete("Franz", 3);
test1 = new TopAthlete("Karl", 5);
} catch (Exception e) {
fail("Unexpected Exception");
}
try {
TopAthlete test3 = new TopAthlete("Sepp", 12);
} catch (ValueException e... |
ca6a629d-c9d9-46c1-ba34-e654d59fded5 | 2 | public Client getClientWithName(String name){
for(Client c: usershere){
if(c.getName().equals(name)){
return c;
}
}
return null;
} |
0805d6c4-9237-4dbc-b21b-a2ccd6c5c304 | 1 | public void updateHUD() {
// If something selected, get panels, set listeners
if (model.selected != null) {
AbstractDescriptionPanel description = model.selected.getDescription();
description.setListeners(dpl);
view.setDescription(description);
AbstractAc... |
f5ea5315-1359-4e9a-812c-79fe17ec2489 | 2 | public static String buildJdbcUrl() {
String jdbcUrl = null;
JdbcInfo jdbcInfo = JdbcInfo.getInstance();
switch (jdbcInfo.getDbmsName()) {
case "mysql": jdbcUrl = buildMysqlJdbcUrl(jdbcInfo); break;
case "h2": jdbcUrl = buildH2JdbcUrl(jdbcInfo); break;
}
... |
4817a087-268b-4eea-83b0-d32a66f19e52 | 3 | private void printBegin(Node t, int n)
{
if (t.getCdr().isNull())
{
t.getCar().print(n+4, false);
System.out.println();
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
t.getC... |
9a67ea73-77db-4778-98f5-fd44226bd3db | 3 | public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
{
String str1=req.getParameter("id");
String str2=req.getParameter("pass");
Connection conn;
Statement stmt;
ResultSet rs;
res.setContentType("text/html");
PrintWriter out=res.getWriter();
... |
ddcb322d-1929-4087-8cc7-2ba92227b925 | 7 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
Album[] a = new Album[m];
int total = 0;
for (int i = 0; i < m; i++) {
int size = sc.nextInt();
a[i] = new Album(i+1, Math.min... |
f70919c4-47d2-4953-8dbc-1951a99f995d | 3 | @Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String[] line = value.toString().split(inDelimiter);
String outputLine = "";
for (int i = 0; i < line.length; i++) {
if (i == Integer.parseInt(targetColumn)) {
if (line[i].equals(oldValue... |
ee6e318e-93e7-4071-a9f2-f7f769a7c619 | 7 | public void testConstructor_int_int_int_Chronology() throws Throwable {
LocalDate test = new LocalDate(1970, 6, 9, GREGORIAN_PARIS);
assertEquals(GREGORIAN_UTC, test.getChronology());
assertEquals(1970, test.getYear());
assertEquals(6, test.getMonthOfYear());
assertEquals(9, test... |
5c066695-8b93-4cb0-b480-f223fc5183a0 | 6 | public boolean xInInterval(int l, int r) {
int lx = this.lefterVertex().centerX();
int rx = this.righterVertex().centerX();
//If either of my endpoints have x in the interval,
//then so do I.
if(lx > l && lx < r) return true;
if(rx > l && rx < r) return true;
//If... |
c1acf1de-c361-42e7-9a6c-54d8c139b72e | 7 | public boolean hasRecommendedUpdate() {
if (installedPack == null || packInfo == null)
return false;
Version installedVersion = getInstalledVersion();
if (installedVersion == null)
return false;
String installedBuild = installedVersion.getVersion();
Li... |
d88ccc6b-88c3-4233-9094-9df5cfcb4414 | 7 | public static void main(String[] arg)
{
String opt;
opt = System.getProperty("SERVICE_OUT");
if (opt != null)
{
try
{
PrintStream stdout = new PrintStream(new FileOutputStream(opt));
System.setOut(stdout);
}
... |
88c3caa1-3047-40c2-8a2f-6d7d8904ac4f | 2 | public static String map(String... cols) {
StringBuilder sb = new StringBuilder();
for (String string : cols) {
sb.append(",`").append(string).append("`=?");
}
return cols.length > 0 ? sb.substring(1) : "";
} |
3bba2284-aaa8-494b-bdab-e982bc9993e4 | 9 | @SuppressWarnings("deprecation")
public static void main(String args[]) throws Exception
{
Random r = new Random();
long seed = r.nextLong();
// seed = 8069103409826870036L;
System.out.println("seed " + seed);
r = new Random(seed);
for (int x = 0; x < 1000; x++)
{
FastVector<NominalPrediction> pred... |
b60b2488-d9e9-4cb1-8c32-a29f692b058e | 7 | public void sortPostingList(){
File sort_done_f =new File(indexDirectory+"/sort_done.dat");
if(!sort_done_f.exists())
sort_done_f.delete();
System.err.println("Sorting posting lists, depending on their size and number, it might take a while...");
try{
String newDi... |
77c149eb-0f00-415a-9c0a-b66d0299a094 | 6 | public void processReader(BufferedReader reader, OutputStream os) throws IOException {
String command = "null command";
while(command != null && command.equals("") == false && command.equals(CRLF) == false) {
command = reader.readLine();
if(command == null)
return;
StringTokenizer st = ... |
826e3ade-231a-47b8-8e41-d9265f6438d8 | 7 | short convertEncodedMad(int size) {
if (size == 0)
return 0;
if (size == -1000) { // temperature
int diameter = getBfactor100() * 10 * 2;
if (diameter > 4000)
diameter = 4000;
size = diameter;
}
else if (size == -1001) // ionic
size = (getBondingMar() * 2);
else if (size < 0) {
size = -s... |
fe7ca0ed-f1fd-436c-9eca-c68f50db6f8c | 8 | @FXML
void exportarCSV(ActionEvent event) {
File file = Util.showSaveChooser();
if (file != null) {
BufferedWriter wr = null;
try {
Table get = connection.getDatabase().getTables().get((String) ((TreeItem) dataBases.getSelectionModel().getSelectedItem()).getVa... |
4cd6b8e1-8787-43fa-bd4f-bec2435709d7 | 4 | public void rozlacz()
{
try {
if(out != null)
out.close();
if(in != null)
in.close();
if(socket != null)
socket.close();
czyRozlaczono = true;
} catch (IOException e) {System.out.println("Błąd RozlPolacz: "+e.getMessage());
}
} |
bed29ae8-929f-4feb-8211-c1d070c7c603 | 6 | private void eventManager()
{
/*
* Add an action (upload file) to double click on selected item
*/
MouseListener mouseListener = new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
/* Double Click*/
{
if( !alre... |
420c69a3-cf29-4e76-99f0-82ce7363d57c | 8 | double calcPathAngle(double DesiredX, double DesiredY) {
double currentX = odo.getX();
double currentY = odo.getY();
double degreeWant = Math.atan(Math.abs(DesiredY - currentY)
/ Math.abs(DesiredX - currentX))
* 180 / Math.PI;
// In the first quadrant
if (DesiredX - currentX > 0 && DesiredY - curren... |
fb61ef4b-f11e-446b-b143-57ee68ef2a88 | 2 | public double getDouble(String key) throws JSONException {
Object object = get(key);
try {
return object instanceof Number ?
((Number)object).doubleValue() :
Double.parseDouble((String)object);
} catch (Exception e) {
throw new JSONExceptio... |
d1a3fe31-d1d3-4cbd-a156-aa37eef01916 | 2 | String convertCase(String str) {
if (str == null) {
return null;
}
return sensitive ? str : str.toLowerCase();
} |
b1d2ad03-4de6-4a82-abaa-e0b36d188bdd | 8 | public static Distribution getDistributionFromConfigFile(String mainTagPath) throws CorruptConfigurationEntryException {
getRandom(); // initialize the randomGenerator
String distributionName = Configuration.getStringParameter(mainTagPath + "/distribution");
try {
Class<?> c = Class.forName("sinalgo.tools.s... |
fa754f10-f399-4391-87c4-410503f259cd | 3 | public void setSelectedItem( Object anItem ) {
for( int i = 0; i < this.list.size(); i++ ) {
if( this.list.get(i) == anItem || this.list.get(i).equals(anItem) ) {
this.selectedIndex = i;
return;
}
}
} |
c405713d-8161-40ac-91e6-b7ed5d633bae | 7 | private final static void checkMinimal(int ch, int minValue) throws IOException {
if (ch >= minValue)
return;
int actualLen;
switch (minValue) {
case MIN_2_BYTES:
actualLen = 2;
break;
case MIN_3_BYTES:
actualLen = 3;
b... |
d03f5ebf-5f6f-42d9-aea6-7a243eaad8fe | 6 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SpEmployeeTargetItemDetailPK other = (SpEmployeeTargetItemDetailPK) obj;
if (!Objects.equals(this.szYear,... |
d0600a98-6e21-4cf1-aa98-06eea5a790a6 | 8 | @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("score:").append(preservation.toString());
sb.append(", ").append("names:").append(preserveReadNames ? "preserve" : "lossy");
if (captureAllTags) {
if (ignoreTags == null || ignoreTags.isEmpty()) {
sb.append(", ").appen... |
8de0d544-d662-4d98-9634-a0b95fabb24a | 1 | private String generatePostData(String query) throws UnsupportedEncodingException {
String postData = "strText=" + URLEncoder.encode(query, ENCODING);
for (Map.Entry<String, String> formValue : formValues.entrySet() ) {
String key = formValue.getKey();
String value = formValue.ge... |
84205ab0-dd76-439a-8562-029e1e874722 | 5 | private Configuration() {
// Open the configuration directory... if it doesn't exist, make it and the file and use
// the default settings.
File configDir = new File("./config");
File configFile = new File("./config/configuration.txt");
if (!configDir.exists()) {
try ... |
c8956e11-4ce2-476a-8d53-cc495950111f | 0 | public void setAnzahlEinheiten(int n) {
this.anzahlEinheiten = n;
} |
509f0142-75f0-4488-9766-1733ef49f1fb | 0 | public ConfigurationPane getPane() {
return (ConfigurationPane) getSource();
} |
ac29708f-f0cc-49da-b798-0b8d64f7a961 | 0 | public Long getId() {
return id;
} |
3ef394e6-5a23-4743-aca0-a79303088510 | 6 | public static void main(String[] args){
if(args==null || args.length<1){
System.out.println("Missing parameters!");
System.out.println("parameter 1 : mode of operation");
System.out.println("Those are : " + Boat.RACE_MODE + ", " + Boat.STATION_KEEPING_MODE);
System.out.println("parameter 2 : name of wayp... |
fbc750f2-62e5-4e7a-bb6f-c0a8c70f506d | 9 | public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Scanner in = new Scanner(new File("d:\\programDATA\\Watersheds\\B-small-practice.in"));
System.setOut(new PrintStream(new File("d:\\programDATA\\Watersheds\\B-small-practice.out")));
int T = in.nextInt();
for (int cur... |
ac204ea3-f288-4feb-a1d5-87dd0a3c371a | 3 | public LoadXmlFile(String xmlPath, String xmlFileName)
{
this.xmlPath = xmlPath;
this.xmlFileName = xmlFileName;
try
{
File fXmlFile = new File(xmlPath+xmlFileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
dBuilder = dbFactory.newDocumentBu... |
8b1e21b8-f531-4d3c-8dbb-680b4ed81803 | 1 | private void moveUp() {
int[] rows = table.getSelectedRows();
DefaultTableModel model = (DefaultTableModel) table.getModel();
if (model.getRowCount() >= 2) {
model.moveRow(rows[0], rows[rows.length - 1], rows[0] - 1);
table.setRowSelectionInterval(rows[0] - 1,
rows[rows.length - 1] - 1);
}
} |
a33f8cb7-b087-4a76-a9e9-c29b0d5cdc88 | 7 | public File getLocalFile(URI remoteUri)
{
if (baseURL != null)
{
String remote = remoteUri.toString();
if (!remote.startsWith(baseURL))
{
return null;
}
}
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
... |
3a6bea9c-05c9-4144-9983-d973d07f1d51 | 2 | private void fillTours(List<Tour> tours, AbstractDao dao) throws DaoException {
if (tours != null) {
for (Tour tour : tours) {
Criteria directCrit = new Criteria();
directCrit.addParam(DAO_ID_DIRECTION, tour.getDirection().getIdDirection());
List<Direc... |
dea8324c-9a13-4e3b-a29e-94cf5ec03302 | 4 | private void processRunCommand(String[] args) {
if (args.length <= 1) {
System.out.println("usage: run PROCESS_NAME ARG...");
} else {
String processName = args[1];
String[] processArgs = new String[args.length - 2];
for (int i = 2; i < args.length; i++) {... |
b1d94aeb-2eb7-4f55-b5d9-c2bdd8af4f06 | 7 | private void checkCollision() {
for(Platform platform : Game.getPlatforms()) {
if(getCollider().intersects(platform.getCollider())) {
_onGround = true; // TODO: Proper _onGround checking
switch(platform.getId()) {
case Platform.HIGH_JUMP:
_highJump = true;
break;
case Platform.NORMAL... |
12831a64-0f04-4691-a40f-e1ca0e8eaf65 | 3 | private CardGroup[] extractSameSigns(ArrayList<Card> cards) {
CardGroup[] groups = new CardGroup[4];
for (int i = 0; i < groups.length; i++) {
groups[i] = new CardGroup();
}
for (Card card : cards) {
groups[card.sign.ordinal()].add(card);
}
for (CardGroup cardGroup : groups) {
cardGroup.sort();
}... |
31621061-69ac-4716-91d0-52c421f43a5f | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (containers.size() == 0) {
return null;
}
GameDescriptor descriptor = containers.get(rowIndex).descriptor;
if (columnIndex == 0) {
return descriptor.getName();
} else if (columnIndex == 1) {
return containers.get(rowIndex).saveDa... |
6b4ad463-487a-4f16-a12f-99629281bf92 | 0 | @Override
public void setDbname(String dbname) {
this.dbname = dbname;
} |
60f4bca8-a5dd-46ac-b108-cb07368647fb | 5 | @Override
public void actionPerformed(GuiButton button)
{
if(button.id == 0)
{
mainCollider = new ColliderBox(new Vector2(150,175),new Vector2(200,150));
} else if(button.id == 1)
{
mainCollider = new ColliderSphere(new Vector2(250,250),100);
} else if(button.id == 2)
{
moveCollider = new Collide... |
cd8e6347-4624-495b-aa40-5d38d836a393 | 0 | public String getCarriedKeyName() {
return carriedKeyName;
} |
1dffded3-8a27-43f3-a8ee-43f14043e97b | 4 | private static void SimpleIfElse() {
Scanner input = new Scanner(System.in);
System.out.print("Enter a number between 0 and 10: ");
int iNumber = input.nextInt();
if (iNumber > 5) {
if (iNumber > 8) {
System.out.println("Number Greater Than 8");
} else {
System.out.println("Number Between 5 and ... |
b59f27e1-295b-45f0-88ad-33713d7ce2e4 | 6 | private void handleFailed()
{
uncompletedCount = 0;
completedCount = 0;
for(OnDemandData onDemandData = (OnDemandData) requested.reverseGetFirst(); onDemandData != null; onDemandData = (OnDemandData) requested.reverseGetNext())
if(onDemandData.incomplete)
uncompletedCount++;
else
completedCount++;
... |
3ae37cdf-ad50-4d10-9774-c8994665d299 | 9 | private JPanel getTableMakananDikonsumsiPanel(){
JPanel panel = new CusomJPanel(new BorderLayout());
String [] columnName = {"Nama Makanan", "Jumlah" , "Waktu Makan" , "Total Karbohidrat", "Total Protein", /*"Total Kalori",*/ "Total Lemak"};
customTableModelMakananDikonsumsi = new CustomTableMod... |
f4f58cb4-ad77-4f80-96e6-bd435d79ed9b | 5 | private static void handleConnectingPlayers(
Collection<Integer> availablePortNumbers,
ServerSocket initialConnectionServerSocket) throws Exception {
Socket initialConnectionClientSocket = initialConnectionServerSocket.accept();
Set<String> currentlyAvailableGames = gameNameToNumberAvailableSeats.key... |
3e2f6dde-5484-4c83-90af-da6a024f9a9e | 8 | public static String decode(ByteInput in, char[] out) throws UTFDataFormatException {
int s = 0;
while (true) {
char a = (char) (in.readByte() & 0xff);
if (a == 0) {
return new String(out, 0, s);
}
out[s] = a;
if (a < '\u0080') ... |
50edcb94-1821-47db-8efd-758632b7582b | 7 | @Override
public Iterator<E> iterator() {
return new AbstractIterator<E>() {
private boolean endOfChannel = false;
@Override
protected E computeNext() {
if (!buffer.hasRemaining()) {
if (endOfChannel) {
return e... |
570702c2-704a-4bed-b0f0-3e9a34bd440a | 6 | public static void debugLoop() {
while (Keyboard.next()) {
if (Keyboard.isKeyDown(Keyboard.KEY_E)) {
System.out.println("Entities:");
for (Entity entity : Entity.entities) {
System.out.println("\tEntity: " + entity.getClass().getSimpleName() + " " + "(" + entity.x + "," + entity.y + ")");
}
Sy... |
4c911213-a186-4823-8905-f63ab532660b | 7 | public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
switch (keyCode) {
case KeyEvent.VK_LEFT : left = false; break;
case KeyEvent.VK_RIGHT : right = false; break;
case KeyEvent.VK_UP : up = false; break;
case KeyEvent.VK_DOWN : down = false; break;
case Ke... |
3ef0714f-d9c0-4795-b0b0-f878e024b30d | 5 | public static void main(String[] A){
double time=0.0;
Simulator s= new Simulator(20,80);
s.init();
for (int i=0;i<20;i++){
Customer c;
double r= 0.5+Math.random()*1;
time +=r;
int mobil= (int)(Math.r... |
8775a4bd-9139-4a78-bb20-aff62e517356 | 8 | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Insets insets = getBorderInsets(c);
Graphics2D g2 = (Graphics2D) g;
// Get width and height of the images
int topHeight = getHeight(topImage);
int leftWidth = getWidth(leftImage);
... |
70bf28df-c805-4972-a10f-1fb48628c738 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Item)) {
return false;
}
Item other = (Item) object;
if ((this.id == null && other.id != null) || (this.id != n... |
b573528f-37c1-41d7-8e41-a4a9aea7c71f | 5 | public String explainScore(StringWrapper s, StringWrapper t) {
String S = s.unwrap(),
T = t.unwrap();
StringBuffer buff = new StringBuffer();
buff.append("\n****TagLinkToken****\n");
buff.append("Si=" + S + ", Tj=" + T + "\n");
double totalScore = 0.0;
if (S.equals(T)) {
matched = S.length... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.