method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cf0bd042-f371-4b02-8e87-2c2c98e0c468 | 5 | private static void launch_missile(War war) {
if (war.getLaunchers().isEmpty()) {
System.out.println("\n\tNo available Launchers");
} else {
EnemyLauncher user_launcher = null;
System.out.println("Destination of the missile: ");
String destination = scanner.nextLine();
System.out.println("Damage of t... |
22246990-4cbe-4199-b0a8-555fd8883bbb | 5 | private int readEscape(int c) throws IOException {
// assume c is the escape char (normally a backslash)
c = in.read();
int out;
switch (c) {
case 'r':
out = '\r';
break;
case 'n':
out = '\n';
break;
... |
98e64d7e-8bf7-49ad-8624-d60966184dba | 4 | public int getPixel(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height)
return -1;
return pixels[x + y * width];
} |
23421ad9-d366-4e28-b60b-17025bcae1ea | 8 | public void updateColors() {
for(int y = 0; y < 9; y++) {
for(int x = 0; x < 9; x++) {
int value = MainMenu.game.getBoard().getTile(x, y).getValue();
//If there is a value in the tile
if(value > 0) {
//and it is not a tile that cannot be update... |
e74d0c00-4e6f-4f2d-9823-cf851da48812 | 4 | @Override
public void mouseMoved(MouseEvent e) {
mx = e.getX();
my = e.getY();
//TODO Delete this soon...
if(e.getSource() == home) {
fractionInfo();
} else if(e.getSource() == host) {
decimalInfo();
} else if(e.getSource() == join) {
integerinfo();
} else if(e.getSource() == refresh) {
mi... |
87c0a02e-a783-487a-ae7c-8ad0507b6ab9 | 2 | @GET
@Path("/userlogin")
@Produces("text/xml")
public Response getUser(@QueryParam("username") String username, @QueryParam("password") String password) {
User user = db.getUser(username);
if(user != null) {
boolean validUser = db.validate(user, password);
if(validUser) {
token = nextSessionId();
A... |
71dd0fb7-14c5-4a38-9c53-e27340d5a0bd | 8 | @Override
public LegendItem getLegendItem(int datasetIndex, int series) {
CategoryPlot cp = getPlot();
if (cp == null) {
return null;
}
if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
CategoryDataset dataset = cp.getDataset(datasetIndex);
... |
33b8e155-98fb-49c0-92f8-8e24e5bf3a37 | 5 | protected boolean collision(double xa, double ya) {
boolean solid = false;
for (int c = 0; c < 4; c++) {
double xt = ((x + xa) - c % 2 * 15) / 16;
double yt = ((y + ya) - c / 2 * 15) / 16;
int ix = (int) Math.ceil(xt);
int iy = (int) Math.ceil(yt);
if (c % 2 == 0) ix = (int) Math.floor(xt);
if (c ... |
64b557b1-c187-498e-aff9-02aae86fd3fb | 2 | private void tworzNowaGre() {
campaign.setIntroText(projectTabPane.introTextList);
campaign.setOutroText(projectTabPane.outroTextList);
campaign.setGameTitle(projectTabPane.getGameTitle());
campaign.setGameDate(projectTabPane.getGameDate());
campaign.setIntroPics(rewriteJListToArrayList(projectTabPane.introPi... |
6abf1dab-1120-4ca8-a514-4d48c0d969d9 | 2 | public T dequeue() {
if (isEmpty())
throw new QueueUnderflowException("Helpful msg.");
T ans = front.getInfo();
front = front.getLink();
if (front == null)
rear = null;
return ans;
} |
b6c3efad-68c8-48eb-8d86-ff41940d2f1f | 7 | private boolean playSound(File file) {
boolean ret = false;
AudioInputStream in = null;
try {
in = AudioSystem.getAudioInputStream(file);
} catch (Exception e) {
logger.log(Level.WARNING, "No audio input stream for: "
+... |
30c4ae6e-1074-4af2-b1fc-fb0d97016879 | 3 | public Move chooseMove(State s) {
// remember who we are (evalState likes to know that)
me = s.whoseTurn();
// get a list of possible moves
MyList moves = s.findMoves();
// return if there are no moves
if (moves.size() == 0)
return null;
// introduce some randomness
Collections.shuffle(moves);
// Ite... |
d0e180e5-6e9a-4960-90a1-9fced11a9096 | 9 | public void findWeights(int row, double[][] mean){
double[] neww = new double[m_Dimension];
double[] oldw = new double[m_Dimension];
System.arraycopy(m_Change[row], 0, neww, 0, m_Dimension);
//for(int z=0; z<m_Dimension; z++)
//System.out.println("mu("+row+"): "+origin[z]+" | "+newmu[z]);
doubl... |
f34b04e9-0c29-4601-a397-4413a54df680 | 1 | public String[] getAttributeNames() {
String[] s = new String[attributes.length];
for (int i = 0; i < attributes.length; i++) {
s[i] = attributes[i].name;
}
return s;
} |
2f22070e-2dd9-4c71-8ca6-b3349d723f97 | 6 | public MakeCommandTree() throws CreateCMDTreeErrorException
{
CMDLIST = new HashMap< String, Integer >();
IfStack = new Stack< CommandNode >();
WhileStack = new Stack< CommandNode >();
SwitchStack = new Stack< Byte >();
CMDLIST.put( "if", 1 );
CMDLIST.put( "else", 2 );
CMDLIST.put( "endif", 3 );... |
77416716-b477-4041-acf5-e6974c4ab843 | 2 | public dbConn(String FD)
{
try
{
lstPeople = new LinkedList<People>();
this.fdName = FD;
this.connection = DriverManager.getConnection("jdbc:sqlite:" + FD );
this.connected = true;
this.statement = connection.prepareStatem... |
5d1f5114-d992-4c19-a606-cd285cc6c4fd | 9 | public synchronized void addBooks(Set<StockBook> bookSet)
throws BookStoreException {
if (bookSet == null) {
throw new BookStoreException(BookStoreConstants.NULL_INPUT);
}
// Check if all are there
for (StockBook book : bookSet) {
int ISBN = book.getISBN();
String bookTitle = book.getTitle();
St... |
e3a331e7-8191-4e69-b141-29a772b2b4af | 7 | private void initListeners() {
ToolsTableListener listener = new ToolsTableListener(toolsTable, toolsTableModel, this);
toolsTable.getSelectionModel().addListSelectionListener(listener);
toolsTable.addMouseListener(listener);
toolsTable.addMouseMotionListener(listener);
server... |
5a099fe2-16e0-4a0f-a0ee-8fd0084eafff | 7 | private int[][] readSamples(ByteBuffer buf) {
// calculate the number of samples in the table
int size = 1;
for (int i = 0; i < getNumInputs(); i++) {
size *= getSize(i);
}
// create the samples table
int[][] samples = new int[size][getNumOutputs()];
... |
3aaf44b1-40c6-4bca-938e-a900c6e7e6c8 | 6 | void workLift() {
/*
* this replaces togglelift - after hugh's helpful comments
*/
if (cloud != null || circuit != null) return;
Hill h = null;
if (app.landscape != null) h = app.landscape.getHillAt(flyingDot.p);
if (h != null) {
setCircuit(h.getC... |
06d7bac0-f9d2-4a1f-99a9-c14921466872 | 2 | public static String readConfig(String key) {
String propertyValue = null;
try {
if (config == null) {
initialize();
}
propertyValue = config.getProperty(key);
} catch (Exception exception) {
exception.printStackTrace();
}
return propertyValue;
} |
6299c2c9-547b-489e-88e7-0e4d46fa77d0 | 3 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (active(request)) //if there is an active user
{
if (request.getRequestURI().equals(request.getContextPath() + "/following")) //if no string occurs after following/
{
List<User... |
f194daa9-a19e-4f9b-a265-e2094641ba0b | 2 | public void setEditable(boolean editable) {
for (int d1 = 0; d1 < dimension; d1++) {
for (int d2 = 0; d2 < dimension; d2++) {
pIn[d1][d2].setEditable(editable);
}
}
} |
660e54ee-8527-45cc-9376-903a7280285f | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
6352660e-c1fb-435c-9c14-2bfd4d02b2ba | 7 | public double[] instanceToSchema(Instance inst,
MiningSchema miningSchema) throws Exception {
Instances miningSchemaI = miningSchema.getMiningSchemaAsInstances();
// allocate enough space for both mining schema fields and any derived fields
double[] result = new doub... |
956fb788-c498-4994-97fc-8dddac8da03a | 1 | private void populateForm()
{
if(this.group.getId() > 0)
{
//txtName.setText(this.group.getName());
this.name = this.group.getName();
this.level_id = this.group.getLevel().getId();
this.teacher = this.group.getTeacher();
this.capacity = this.group.getCapacity();
this.schedule_list = this.group.ge... |
2f45a45e-c050-42fb-9880-191b1aa82cf9 | 3 | private void sort(int[] array){
for(int i = 1; i<array.length; i++ ){
int minInd = i-1;
for(int j = i; j<array.length; j++){
if(array[minInd] > array[j]){
minInd = j;
}
}
swap(array, minInd, i-1 );
}
... |
1038032a-1bca-49ea-a32d-cc121ecb13ae | 8 | public static int ladderLength2(String start, String end, Set<String> dict) {
List<String> nodes = new ArrayList<String>();
nodes.add(start);
nodes.add(end);
for (String val : dict) {
if (!nodes.contains(val)) nodes.add(val);
}
List<GraphNode> graph = generateGraph(nodes);
//pri... |
123993e2-eb28-4266-af93-11b95c215483 | 8 | private void computeAverageClassValues() {
double totalCounts, sum;
Instance instance;
double [] counts;
double [][] avgClassValues = new double[getInputFormat().numAttributes()][0];
m_Indices = new int[getInputFormat().numAttributes()][0];
for (int j = 0; j < getInputFormat().numAttributes();... |
d5f05cff-9c0f-4198-b221-5154faa400d8 | 8 | public void start() {
System.out.println("************************************************************************");
System.out.println(" AddressBook ");
System.out.println(" *A:add new User Address ");
Syste... |
2eef8626-8f2b-47f3-8526-30506d710ae3 | 8 | public String execute(Map<Integer, Record> records) {
Record rec = records.get(this.recordID);
boolean ok = false;
if (super.subject.charAt(0) == 'N') {
if (super.subject.equals(rec.nurseID) || super.departmentID.equals(rec.departmentID)) {
ok = true;
}
} else if (super.subject.charAt(0) == 'D') {
... |
0c22ac8f-58fe-43eb-948c-3be22d59be65 | 2 | public void setVolumePercentage(int percentage) {
if((percentage <= 100) && (percentage >= 0)) {
mediaPlayer.setVolume(percentage);
}
else {
System.err.println("Cannot supply a volume below 0 or above 100");
}
} |
5c94380a-fa1b-4805-beeb-08fe0f3ddb93 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,false);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth floating."));
return false;
}
if(!super.invoke(mob,commands,... |
ac879336-8074-44f2-924b-4a84079393eb | 7 | @Override
public void forcePeaceAllFightingAgainst(final MOB mob, final Set<MOB> exceptionSet)
{
final Room R=mob.location();
if(R==null)
return;
for(Enumeration<MOB> m=R.inhabitants();m.hasMoreElements();)
{
final MOB M=m.nextElement();
if((M!=null)
&&(M.getVictim()==mob)
&&(M!=mob)
&&((exc... |
14ec285b-e6e0-47f8-ba22-b89eb535b1e0 | 6 | public static void main(String[] args) throws IOException {
System.out.println();
System.out.println("Start Time: " + new Timestamp(System.currentTimeMillis()));
long startTime = System.currentTimeMillis();
_testSet.clear();
for (int i = 0; i < args.length; ++i) {
if (args[i].equals("-f")) test(new File(args[... |
2e5fa99b-b2ff-4b38-b3d5-635aac431c72 | 9 | private void searchPaths(Graph graph, Object start, Object searched,
ArrayList<Object> visited) {
if (visited == null) {
visited = new ArrayList<Object>();
visited.add(start);
}
ArrayList<Object> nodes;
if (visited.get(visited.size() - 1) instanceof Station) {
nodes = ((Station) (visited.get(visit... |
234980bd-e891-4c2d-8b0b-39700948e9e4 | 8 | public int insertEmployee(Employee emp) throws UnauthorizedUserException,
BadConnectionException, DoubleEntryException {
String username;
username = generateEmpUsername(emp.getFirstName(), emp.getLastName(), emp.getPhone());
try {
PreparedStatement pStmnt = con.... |
061ecae2-df82-4c11-b2fe-90f1fa78d518 | 0 | @Test
public void conwaySimple1() {
x = 3;
y = 3;
rule = new RuleSet("23/3");
grid = new Grille(x, y, rule);
boolean[][] originalValue = {{true, false, true}, {false, false, false}, {true, false, true}};
grid.setBooleans(originalValue);
Grille expectedGrid =... |
3a604a98-72cb-446a-8f2f-076f3f38300f | 7 | public Memory(int size, int instructionsStartAddress, int dataStartAddress, int accessTime) {
if (size < 128 || size > 4194304)
throw new IllegalArgumentException("Memory size must be greater than 128B and less than 4MB");
if (!Helpers.isPowerOf2(size))
throw new IllegalArgumentException("Memory size (" + ... |
8df48679-2f20-48ac-acb7-0c636659f918 | 3 | public String toString() {
String[] colors = { "Rot", "Gruen", "Blau" };
String result = "";
for (int c = 0; c < 3; c++) {
result += "Die " + colors[c] + "-Werte des Bildes: \n";
for (int x = 1; x <= width; x++) {
for (int y = 1; y <= height; y++) {
result += Math.round(getPixel(x, y, c) * 1000) / ... |
2bb91d10-1029-413a-9be3-1bf454df913d | 6 | public boolean doT2(FlowBlock succ) {
/*
* check if this successor has only this block as predecessor. if the
* predecessor is not unique, return false.
*/
if (succ.predecessors.size() != 1 || succ.predecessors.get(0) != this)
return false;
checkConsistent();
succ.checkConsistent();
if ((GlobalO... |
3ccff149-e0d1-4333-aa09-e31083defae6 | 3 | private double testDynamicArrayInserts(int inserts) {
System.out.println("Testing dynamicArray with " + inserts + " inserts");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
dynamicArray = new DynamicArray();
st... |
99c4e0cf-c253-4508-91c6-452a496a990e | 0 | public int getTargetX() {
return targetX;
} |
33e1afd0-7162-4600-9739-a50628f43cc1 | 4 | @Override
public void run(){
while(true){
try {
sock = server.accept();
String IP = returnIP(sock.getRemoteSocketAddress().toString());
InstantMessenger.remUser = db.getName(IP);
System.out.println(InstantMessenger.remUser);
... |
e67b8405-8ac3-4f26-83e4-6318d6fc8ec7 | 8 | public boolean check() {
boolean good = true;
good = (good ? checkForRequiredHeaders() : false);
good = (good ? checkForSubscription() : false);
good = (good ? checkForEncryption() : false);
good = (good ? Category.checkForLegalCategory(aThis.headerMap) : false);
good = (... |
990e967e-1386-4c10-a359-c8652d5f4d72 | 3 | private static void drawCards(GameState state, ArrayList<Integer> availibleCards,
int numCards)
{
if(availibleCards.size() < numCards)
{
throw new RuntimeException("not enough cards to draw from the deck!");
}
Random cardPicker = new Random();
for(int i = 0; i < numCards-1; i++)
{
int card ... |
50324b24-1d9f-4e08-82b3-ea86e858df0d | 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 SiteBoundaryCategory)) {
return false;
}
SiteBoundaryCategory other = (SiteBoundaryCategory) object;
if ((this.... |
49ec23bb-212e-49ae-ac41-bb72b425a39c | 3 | public static char[] rotate(char[] state, Character face, int turns) {
// Turning it by any number of turns mod 4 would be wasting CPU cycles
if (turns % 4 == 0) {
return state;
}
int[] thisFace = FACES.get(face);
int[] theSides = Cube.SIDES.get(face);
// Error checking to verify that the given character... |
332c84ab-1e2e-4e7c-bf43-b6ad2cc5bf76 | 4 | private void parseRequestParameterFromString(String string) {
// /this/is/the/path?name1=value1&name2=value2....
while (string.length() > 0) {
int indexEqual = string.indexOf("=");
int indexNext = string.indexOf("&");
if (indexEqual == -1) {
break;
}
String paramName = string.substring(0, indexEq... |
7d400499-5930-4d7f-ac3e-f8029269f3e1 | 1 | public void visit_if_icmplt(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_if_icmpge);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_if_icmplt);
addBranc... |
f8a366e7-6bd1-418d-a44c-d91b64fc6cf4 | 7 | public static File findCurrentModuleDir(String directory)
{
// will find something by traversing up
File current = new File(directory);
if (current.getName().equalsIgnoreCase("."))
{
// strange bugfix here...
current = current.getParentFile();
}
... |
35cd5ba0-577c-4dc8-b475-5aefae8ac0f4 | 5 | public static String post(String url, List<NameValuePair> params) {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
if (params != null) {
try {
httpPost.setEntity(new UrlEncodedFormEntity(params,"UTF-8"));
} catch (UnsupportedEncodingException e) {
... |
fce48302-891e-4e3f-934a-bdc49bb1ec48 | 8 | @Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode()==KeyEvent.VK_LEFT||e.getKeyCode()==KeyEvent.VK_A)left=false;
if(e.getKeyCode()==KeyEvent.VK_RIGHT||e.getKeyCode()==KeyEvent.VK_D)right=false;
if(e.getKeyCode()==KeyEvent.VK_UP||e.getKeyCode()==KeyEvent.VK_W)up=false;
if(e.getKeyCode()==KeyEvent.... |
bc68c69d-8707-4833-85af-b198f992bb50 | 9 | void killErosion(int x, int y, GameWorld gw) {
gw.map[y][x].erosion += 20;
if (gw.map[y][x].erosion > 100 && gw.map[y][x].type != Tile.Type.PIT) {
lp: for (int dy = -1; dy < 2; dy++) {
if (y + dy < 0 || y + dy >= gw.map.length) { continue; }
for (int dx = -1; dx < 2; dx++) {
if (x + dx < 0 || x + dx... |
49f6db2c-e172-4a20-accd-b5b5ad2e9e35 | 3 | private boolean jj_3R_30() {
if (jj_3R_31()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_13()) { jj_scanpos = xsp; break; }
}
return false;
} |
cb23cbcc-7322-405f-955b-6f6e1f95f52f | 1 | public AnefodiasmoiAdd() {
/* kartela prosthikis anefodiasmwn*/
con = new Mysql();
setTitle("Prosthiki Anefodiasmou"); //titlos para8yrou
/* vgazei to para8uro sto kedro tis othonis me diastaseis 300x220 */
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds(dim.width/2-150, dim.heig... |
a989a0d0-a15d-41de-a631-31fe9f1003d5 | 3 | public static boolean deleteUnit(String name) {
if(listUnits.containsKey(name)) {
Unit unit = listUnits.get(name);
if(unit instanceof ReferenceUnit) {
if(unit.getType().getUnits().size() > 1) {
// si le type à d'autres... |
5ec8c796-534c-4e87-a647-d85646d5151e | 3 | public void visitMemRefExpr(final MemRefExpr expr) {
if (expr instanceof FieldExpr) {
visitFieldExpr((FieldExpr) expr);
} else if (expr instanceof StaticFieldExpr) {
visitStaticFieldExpr((StaticFieldExpr) expr);
} else if (expr instanceof ArrayRefExpr) {
visitArrayRefExpr((ArrayRefExpr) expr);
}
} |
1eadb83a-e0f4-4d07-98cc-b0c2d31db356 | 5 | public static void main(String[] args) throws Exception {
boolean mt = false;
for(int c=0; c<2; c++) {
long lall = 0, tall = 0;
for(File f : new File("resources/testdata/").listFiles()) {
RandomAccessFile raf = new RandomAccessFile(f, "r");
byte[] data = new byte[(int) raf.length()];
raf.read... |
f49c5bc0-1996-44a9-8f74-432b2c10a050 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
f5f95654-5785-43e9-9122-af5006a91cac | 5 | private static Node index(Node left, Node right)
{
try
{
Object collection = left.getArgument().asObject();
Object result;
if (collection.getClass().isArray())
{
int index = getIndex(right, Array.getLength(collection));
result = Array.get(collection, index);
}
else if (collection instance... |
ff8a0656-38f9-423d-a490-598dde2bbb87 | 4 | public StdImage createDragImage(Point dragOrigin) {
Graphics2D gc = null;
StdImage off2 = null;
mDrawingDragImage = true;
mDragClip = null;
StdImage off1 = createImage();
mDrawingDragImage = false;
if (mDragClip == null) {
mDragClip = new Rectangle(dragOrigin.x, dragOrigin.y, 1, 1);
}
try {
off2... |
b4491feb-bc38-4891-9efe-40570639819f | 2 | public byte[] toByteArray(){
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
out = new ObjectOutputStream(bos);
out.writeObject(this);
byte[] yourBytes = bos.toByteArray();
try{
bos.close();
out.close();
}catch(Exception e){System.out.println("A M... |
56fd73d4-0e49-4615-b906-044f9a07d0d8 | 7 | protected void loadReactionlikeEvent2Input() {
String name = "ReactionlikeEvent_2_input";
String fileName = dirName + name + ".txt";
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
// Parse line
String re... |
78ca504d-77c2-43d0-9965-29bde50fcf38 | 8 | private void drawMenu() {
int i = menuOffsetX;
int j = menuOffsetY;
int k = menuWidth;
int l = anInt952;
int i1 = 0x5d5447;
Graphics2D.fillRect(l, j, i, i1, k);
Graphics2D.fillRect(16, j + 1, i + 1, 0, k - 2);
Graphics2D.drawRect(i + 1, k - 2, l - 19, 0, j... |
6e553df9-7d43-458f-a9c9-11b1e29c9435 | 5 | public static ArrayList<Achievement> updateAchievement(User user) {
ArrayList<Achievement> records = AchievementRecord.getAchievementsByUserID(user.userID, PRACTICE_TYPE);
ArrayList<Achievement> newAchievements = new ArrayList<Achievement>();
for (int i = 0; i < getAllAchievements().size(); i++) {
Achievement ... |
985f6ebe-be4b-4a3b-87dd-2b317a603c56 | 8 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "kick", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 0)
return false;
String msg = plu... |
e32079ad-b25b-4118-9f13-c4eeb4827064 | 4 | public double scale(double i){
if(i>0){
i = (i-0.1)*10.0/9.0;
if(i < 0)
i = 0;
}
else if(i<0){
i = (i+0.1)*10.0/9.0;
if(i > 0)
i = 0;
}
return i;
} |
15127402-3876-46cf-954d-3b2794393455 | 8 | private boolean argumento() {
//<argumento> ::= <id> <compl_tipo_parametro>
//<compl_tipo_parametro> ::= <acesso_campo_registro> | <acesso_matriz>| <chamada_funcao> | λ
//<acesso_campo_registro> ::= ”.” <id>
//<acesso_matriz> ::= “[“ <indice> “]” <acesso_matriz> | λ
//<indice> :... |
4c33a50a-087c-46ec-bc94-24dfab839676 | 7 | public int intern(Object k){
int hash = hash(k);
int mask = cap - 1;
int bkt = (hash & mask);
int bhash = hopidx[bkt<<2];
int slot;
Object bkey;
if(bhash == 0)
slot = bkt << 2;
else
{
if(hash == bhash)
{
bkey = keys[hopidx[(bkt<<2) + 1]];
if(k.equals(bkey))
return hopidx[(bkt<<2) + 1];
}... |
1ea43e74-8323-4dff-b141-374efa286f2a | 8 | public static int getStandardDeviationParamIndex(String accession) {
if (INTENSITY_STD_SUBSAMPLE1.getAccession().equals(accession)) {
return 1;
} else if (INTENSITY_STD_SUBSAMPLE2.getAccession().equals(accession)) {
return 2;
} else if (INTENSITY_STD_SUBSAMPLE3.getAccess... |
67c7270b-4dea-45e9-81f7-9528e97d64ea | 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... |
dc5b258d-3d9f-419c-b5c4-f0a7b73295c6 | 7 | void selfTrain(Instance testInst) {
int maxInstances = this.maxInstancesOption.getValue();
int poolSizeRatio = poolSizeOption.getValue();
int poolLimit = maxInstances / poolSizeRatio;
int poolCount = 0;
VotedInstancePool vInstPool = ActiveClusterBaggingASHT.getVotedInstancePool()... |
474cc476-0a34-4b6b-bfad-c171c465b5ee | 8 | public void actionPerformed(ActionEvent event)
{
String entry = entryField.getText().trim();
if(entry.length() > 1 && entry.charAt(entry.length()-1) == '%')
entry = entry.substring(0,entry.length()-1);
if(event.getActionCommand().equals("Update"))
{
if(entry.equals(""))
JOptionPane.showMessageD... |
1eaf1340-3623-42ea-9cfd-4b71a69e0e17 | 1 | public List<String> splitWords(String source) {
StringTokenizer stringTokenizer = new StringTokenizer(source,delimiters);
List<String> list = new ArrayList<String>();
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
list.add(token);
}
return list;
} |
fb9dab22-34d4-4774-86af-d9d92a60945f | 4 | public static String escape(String msg) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < msg.length(); i++) {
char c = msg.charAt(i);
if (c != '\n' && (c < 32 || c >= 127)) {
c = '?';
}
sb.append(c);
}
return sb.t... |
d9db8ab1-0e30-45dc-a893-8962cccae1cb | 9 | private void drawGrid(Graphics g, Point p1, Point p2, Point p3, Point p4, int gridSizeX, int gridSizeY, int zUnit) {
g.setColor(Color.LIGHT_GRAY);
if (gridSizeX > 0) {
int x = p4.x + gridSizeX, xD = p1.x + gridSizeX;
int y = p4.y, yD = p1.y;
while (x < p3.x) {
g.drawLine(x, y, xD, yD);
x += gridSiz... |
dde77c2e-345c-416c-bc1e-ade3c5d6f0c2 | 8 | public void updateFromBoard(Board board){
setTitle("Connect Four" + ((playerRed)?"(Red Move)": "(Blue Move)"));
for(int i =0;i<ConnectFour.COLUMNS;i++){
for(int j=0;j<ConnectFour.ROWS;j++){
buttons[i][j].setText(board.getBoardArray()[i][j]);
if(board.getBoardArray()[i][j]!=null){
switch(board.getBoa... |
085bbe0b-ba8c-41ef-b934-fdd5565f252b | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frames = new AnalysatorFrames();
structuresBase = new ArraysDataBase();
fileBase = new FileDataBase();
... |
b90bbb97-8825-4621-a53a-107258b5ee1b | 9 | private void loadEvent(String filename) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
getClass().getResourceAsStream(filename), "UTF-8"));
String line;
while ((line = br.readLine()) != null) {
// 空行は読み飛ばす
... |
ba2af49f-225d-4b09-adc2-a920f7f1939e | 1 | public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
if (mv != null) {
mv.visitFieldInsn(opcode, owner, name, desc);
}
execute(opcode, 0, desc);
} |
5db6315a-f2ca-4eb7-a918-57938a2f0870 | 2 | public ClassNode(ClassInfo info, ClassEditor editor) {
this.info = info;
this.editor = editor;
fields = new FieldNode[info.fields().length];
for(int i=0; i<fields.length; i++) {
FieldInfo fieldInfo = info.fields()[i];
fields[i] = new FieldNode(this, fieldInfo, editor.context().editField(fieldInfo));
... |
4f41c376-2d52-4b0b-b31b-968397a22b55 | 9 | private static void generateReturnCode(String returnType, CodeVisitor cv) {
if (returnType.equals("V")) {
cv.visitInsn(POP);
cv.visitInsn(RETURN);
} else if (isPrimitive(returnType)) {
int opcode = IRETURN;
String type;
String meth;
if (returnType.equals("B")) {
type = "java/lang/Byte";
me... |
46136f94-af44-4d0b-8822-b3189a068dce | 3 | public void load(String filename) throws IOException {
if (settings.size() > 0)
settings.clear();
FileInputStream fstream = new FileInputStream("properties/" + filename);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
... |
2ce78f7e-5aec-416e-b66c-e3a5ec7a5b55 | 2 | public String toString() {
Annotation[] a = getAnnotations();
StringBuffer sbuf = new StringBuffer();
int i = 0;
while (i < a.length) {
sbuf.append(a[i++].toString());
if (i != a.length)
sbuf.append(", ");
}
return sbuf.toString();... |
6997dda0-6e79-4c50-a99d-afc8578daab9 | 3 | boolean isPalindrome(String str, int s, int e) {
if (s == e)
return true;
for (int i = s, j = e; i < j; ++i, --j) {
if (str.charAt(i) != str.charAt(j)) {
return false;
}
}
return true;
} |
5b36a9be-b6be-40e5-849b-76a7133bece1 | 6 | public void update()
{
// This section ensures that we have the right children, without constantly removing/adding them,
// which causes user-unfriendly behaviors (unselection etc)
{
Set<Component> text_area_components = new HashSet<Component>();
for(Component c : text_area.getComponents())
text_... |
5d086051-c65b-49d2-95e8-80b012a9b966 | 3 | @Override
public void run() {
while(!terminer){
try {
if(in.ready()){
message = in.readLine();
MonInterface.fabrique.decoderTrame(message);
System.out.println("Trame CAN reçu");
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("fermeture thread");
/... |
fe6be37f-44f5-4a02-a175-3f3105501c41 | 1 | public void printlnEntradas(){
for(Nodo<Rama_Hoja> iterador = _entradasDelArbol.getHead(); iterador != null; iterador = iterador.getSiguiente()){
System.out.println(iterador.getDato().getIdentificador());
}
} |
bda5bea3-83d0-4431-808c-49c7d576a6bb | 1 | public void enableVoteButtons(boolean s) {
for (Card value : View.cards.values()) {
value.vote.setEnabled(s);
}
} |
dd0f421e-e4e9-44ba-8144-cae100bffda9 | 2 | public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... |
0d843204-dfd4-418b-8078-1d612a80011c | 9 | @Override
protected void toASCIIGnuStep(StringBuilder ascii, int level) {
indent(ascii, level);
NSObject[] array = allObjects();
ascii.append(ASCIIPropertyListParser.ARRAY_BEGIN_TOKEN);
int indexOfLastNewLine = ascii.lastIndexOf(NEWLINE);
for (int i = 0; i < array.length; i++... |
f17e57dd-2843-4617-bff0-ec3253fcae80 | 0 | protected void end() {} |
059c66f9-36c2-42ea-918b-001b0ea51b7f | 8 | public static String genSlaveFilename(String master_filename, String prefix_name, String ext_name)
throws MyException {
String true_ext_name;
int dotIndex;
if (master_filename.length() < 28 + FDFS_FILE_EXT_NAME_MAX_LEN) {
throw new MyException("master filename \"" + mast... |
8c32cff8-ba1a-4ca7-855d-6d72e1c988c3 | 1 | @OnLoad
public void onLoad() {
ScheduleModel sched = DataStore.getSchedule(getRes_schedId());
if(sched!=null) this.res_sched = sched;
} |
ab2a6c89-98fa-4320-bb56-457fba449c0b | 3 | public String Logar(String protocolo) throws SQLException{
String resultado[] = protocolo.split("-");
for(Cliente tmp : clientes.ProcurarTudo()){
if(tmp.getLogin().equals(resultado[1]) && tmp.getSenha().equals(resultado[2])){
return "LoginValido... |
33a19b87-d721-4392-8d1e-6dd00a2c0736 | 4 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
String line;
int sum;
while (inputScanner.hasNextLine()) {
line = inputScanner.nextLine();
... |
6040b397-3895-42bb-bcfa-de50215d928f | 9 | @Override
protected void updateTick(final EntityHandler caller) {
Map<Long, Entity> others = caller.getEntityMap();
if (pos.x < 0 || pos.x > Constants.WIDTH)
kill();
if (pos.y < 0 || pos.y > Constants.HEIGHT)
kill();
// do not check for collision if last collision was too short before
if (!timerBreak... |
5cec10b2-158e-456b-b790-ed27e7e8461c | 8 | public static void main(String args[]) {
if (args.length < 4) {
usage();
}
int cacheSize = Integer.parseInt(args[0]);
String diskName = args[1];
int diskSize = Integer.parseInt(args[2]);
StringBuffer shellCommand = new StringBuffer(args[3]);
f... |
c387dfad-44ff-4a94-9be2-7463f07ed953 | 1 | @Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.