method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2b756205-305e-4030-a26f-88a27c82ebdc | 5 | private void preOrder() {
if (popups.isEmpty()) return;
for (int i = 0 ; i < popups.size() ; i++) {
switch (popupLocation) {
case TOP_LEFT: case TOP_CENTER: case TOP_RIGHT: popups.get(i).setY(popups.get(i).getY() + height + spacingY); break;
... |
b5be1b9f-50f7-4d85-b27d-cd68a7b86c2c | 6 | public boolean shellCollideCheck(Shell shell)
{
if (deadTime != 0) return false;
float xD = shell.x - x;
float yD = shell.y - y;
if (xD > -16 && xD < 16)
{
if (yD > -height && yD < shell.height)
{
world.sound.play(Art.samples[Art.SAMP... |
7d1cc4f9-a0cb-4216-8e3a-9db28bd97ebd | 3 | @Override
public int getChildCount(Object node)
{
int i = 0;
File d = ((FileWrapper) node).getF();
for (File f : d.listFiles())
{
if (this.showFiles)
{
++i;
} else if (f.isDirectory())
{
++i;
... |
db217220-2a24-4cbc-9d91-14a83c9d984a | 9 | public static String UCS2toUTF16(byte[] input) {
if ((input[0] & 0xff) == 0x80) {
String outputInUTF16 = "";
int i = 1;
while (((input[i] & 0xff) != 0xff) && ((input[i + 1] & 0xff) != 0xff)) {
byte[] segment = {input[i], input[i + 1]};
int intV... |
8a00ec86-d740-49be-82d0-0f9972887570 | 0 | public int getRsrceType() {return biomeRsrceType[this.getBiome()];} |
fb6135fb-6090-4c40-b05f-c58619e7bcb7 | 5 | private void UpdateUser() {
if (oldEmployeeName.getText().isEmpty() || oldEmployeePassword.getText().isEmpty() || oldEmployeeUsername.getText().isEmpty() || oldEmployeeUsername.getText().isEmpty()) {
System.out.println("UDFYLD ALLE FELTER!");
} else {
try {
Employ... |
1f994fee-714d-4b7b-93e4-42945dfc3c18 | 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 ... |
db922939-d82b-4312-a575-280b8725e19f | 6 | 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 ... |
0b462363-ca60-4e71-87f5-1ce25c96289a | 3 | @RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = "application/json")
public ResponseEntity<?> update(@PathVariable("id") int videoId,
@RequestBody Video video,
@RequestParam(required=false) String searchFor,
@RequestParam(required=false, defaultValue=DEFAULT_PAGE_DISPL... |
f608ac4c-dacf-4da0-b8ce-fd2b560a1c1b | 5 | @Override
public int update(int h, int dRow, int dCol) {
int now = 0;
int old = 0;
if (dCol == 0) {
int numOwnRow = puzzle.lastMove / 4;
if (puzzle.getEmptyRow() == numOwnRow) {
now = calHorizontal(numOwnRow);
puzzle.setCell(numOwnR... |
b27a162d-fc88-4b60-b2f6-46118b59c284 | 1 | private void addToExcludedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addToExcludedBtnActionPerformed
List<File> ls = includedList.getSelectedValuesList();
Model m = controller.getModel();
for(File f : ls){
m.getFilesToInclude().remove(f);
m.getFilesToExclude().add(f);
}
update... |
035cd8e3-12fb-4532-bf68-71376919bf4e | 1 | public String toString() {
String x = "(locals";
for (int i = 0; i < locals.length; i++) {
x += "\n (local @" + locals[i].index() + " name="
+ locals[i].nameIndex() + " type=" + locals[i].typeIndex()
+ " pc=" + locals[i].startPC() + ".."
+ (locals[i].startPC() + locals[i].length()) + ")"... |
a4b67702-aa59-44ac-939e-76421ce3e337 | 4 | public Area getAreaByName(String str)
{
if (str.equalsIgnoreCase("main"))
return this.mainArea;
if (str.equalsIgnoreCase("warmup"))
return this.warmUpArea;
if (str.equalsIgnoreCase("win"))
return this.winArea;
if (str.equalsIgnoreCase("loose"))
return this.looseArea;
return... |
c1678a8d-af53-49d9-a7c0-64aa35bdfd98 | 7 | private void go() throws IOException {
// Create a new selector
Selector selector = Selector.open();
// Open a listener on each port, and register each one
// with the selector
for (int i = 0; i < ports.length; ++i) {
ServerSocketChannel ssc = ServerSocketChannel.ope... |
87c70bbc-55e2-43b2-9755-2f2ba29be835 | 2 | public Object execute(ExecutionEvent event) throws ExecutionException {
List<IWorkbenchPartReference> editors = new ArrayList<IWorkbenchPartReference>();
List<IWorkbenchPartReference> views = new ArrayList<IWorkbenchPartReference>();
enumerateWorkbenchParts(editors, views);
editors = Activator.getActivationH... |
57c273b6-57ed-4054-9bf6-21d1cecc58b5 | 7 | public void write(byte[] buffer) {
if (dataLine == null)
return;
int bsize = buffer.length;
if (!fullSpeed) {
while (dataLine.available() < bsize)
try {
Thread.sleep(1);
} catch (Exception e) {
}
} else if (dataLine.available() < bsize) {
return;
}... |
36b6e53f-7ea2-4a04-9aba-36cb5bc817cf | 2 | public List<Player> getAllPlayersOnGrid() {
List<Player> players = new ArrayList<Player>();
for (Element e : getElementsOnGrid()) {
if (e instanceof Player)
players.add((Player) e);
}
return Collections.unmodifiableList(players);
} |
6abc85ac-a745-4eb4-bcc6-914ab894e040 | 9 | public Rectangle getRectAroundSpriteAtPoint(final Point aPoint)
{
markInfectNonTransparents(aPoint.x, aPoint.y);
int minX = aPoint.x;
int minY = aPoint.y;
int maxX = aPoint.x;
int maxY = aPoint.y;
for (int y=0; y<_imgH; ++y)
{
for ... |
737fe4cb-5cce-48ec-8b8f-c28b5d538926 | 5 | public void decreaseUse(ItemStack item, Player player) {
// Player can bypass uses so no 'use' is used.
if (player.hasPermission("scrollteleportation.usesbypass")) {
return;
}
ItemMeta im = item.getItemMeta();
List<String> lore = im.getLore();
// Get last lore line
String uses = plugin.fixName(lore... |
e4a134f1-893e-4c84-9a59-4f41f584aad4 | 9 | private void advance() {
// find the smallest element from any iterator.
next = nextList[0];
for (int i = 1; i < itList.length; i++) {
E other = nextList[i];
/*
* A.compareTo(B) returns a negative integer, zero, or a positive
* integer as A is less than, equal to, or greater than B.
*/
if (ot... |
46b3bd84-c70e-4617-b6e0-8a87a15dee7d | 5 | public void search(double goal) {
Point2D position = null;// = new Point2D.Double(0, 0);
//saveState(position, position, 0);
while (!queue.isEmpty()) {
position = queue.poll();
if (goal == position.getX() || goal == position.getY()) {
//last = position;
... |
9f8ee4ea-1c0d-490a-802f-075d8641631b | 0 | public void sayHello() {
System.out.println("Hello");
System.out.println("My name is " + name);
System.out.println("My age is " + age);
course.aboutCourse();
} |
e01249b7-e0e7-438a-815a-32d0ced33ef6 | 6 | @AroundInvoke
public Object enforceSla(InvocationContext context) throws Exception {
Long timestamp = System.currentTimeMillis();
if(this.controller.isSlaComplient(timestamp) && this.controller.isAvailable()){
SystemUnavailable unavailability = this.controller.buildUnavailability(timestamp);
if(unavailabi... |
f4996462-b508-446b-9b72-9a29b9f7eb39 | 2 | public User viewUserbyName(final String name) {
for (User u : userList.getUserList()) {
if (name.equals(u.getName())) {
return u;
}
}
return null;
} |
ac1d0a46-543f-4906-aa4a-5bf69e1a692f | 6 | @EventHandler
public void BlazeNightVision(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.getBlazeConfig().getDouble("Blaze.NightV... |
e52be85e-9148-487b-8578-796e08a68a53 | 5 | @Override
public Property removeCapabilities(Property property) throws PropertyException
{
if(property instanceof DatarateProperty) {
// data rate required?
if(getMin() != UNDEFINED) {
int minDRprovided = ((DatarateProperty) property).getMin();
if(minDRprovided != UNDEFINED) {
if(getMin() <=... |
3e6da1a9-380f-459c-8ed8-abc8c2a9e58f | 3 | private void updateAnswers() {
answerMemoryModel.clear();
ArrayList<Conditional> answers = engine.getAnswer();
if (answers.isEmpty()) {
answerMemoryModel.addElement(new Fact("No Results Found"));
} else if (answers.size() > 1) {
answerMemoryModel.addElement(new Fa... |
055e1b5e-1800-4a83-a6bd-08dd6f6ea674 | 3 | protected void destroy() {
for (IOThread it: io_threads) {
it.stop();
}
for (IOThread it: io_threads) {
it.destroy();
}
if (reaper != null)
reaper.destroy();
term_mailbox.close();
tag = 0xdeadbeef;
} |
78052858-f3a4-47a1-a983-2381f1e3b50a | 3 | public void checkDestroy(String sub, String obj) {
if (this.subjects.containsKey(sub.toLowerCase())
&& this.objects.containsKey(obj.toLowerCase())) {
if (this.subjects.get(sub.toLowerCase()).compareLess(
this.objects.get(obj.toLowerCase()))) {
this.objects.remove(obj);
this.manage.executeDest... |
427eee30-93a3-4039-bc9c-92f0e486c831 | 2 | public DaytimeDisplayFrame(double[][] inProbs, String inRoles, int inSize){
SizeMemory = inSize;
final JDialog dialog = new JDialog(this, "Quantum Werewolves", Dialog.ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dialog.setLocationRelativeTo(null);
final String ... |
310873c8-aec7-4e00-b2af-187c78f1c8b3 | 2 | public Cycle(Graph G)
{
hasCycle = false;
cycle = new Stack<>();
marked = new boolean[G.V()];
for (int v = 0; v < G.V(); v++)
if (!marked[v])
dfs(G, v, v);
} |
916b5489-482b-4d15-827b-9b09ef39876d | 3 | void setImage(int dice, boolean active) {
if(dice > 0 && dice < 7) {
if(active) {
current = activeDiceImage[dice - 1];
} else {
current = inactiveDiceImage[dice - 1];
}
} else {
throw new IllegalArgumentException("Only Integer between 0 and 7 are allowed");
}
} |
6dabd948-c46f-4896-b414-5de23c2f8ad0 | 3 | public void escribirArch()
{
try {
printWArch = new PrintWriter(new FileWriter(arch));
String s;
System.out.println("Proporciona los datos para el archivo.\nPara salir escriba '**'");
s = Lectura.stringD();
while(s != null)
... |
0d4e9303-9e76-4b4a-9533-a3e111e2ea27 | 2 | public MemberRef methodInvoked(final Type receiver, final NameAndType method) {
// Search up class hierarchy for a class that implements the
// method
for (Type type = receiver; type != null; type = superclass(type)) {
// Construct a MemberRef for the possible method
final MemberRef m = new MemberRef(type, ... |
084649dc-78f1-4318-b494-e476287de4de | 7 | void parseMarkupdecl() throws java.lang.Exception
{
if (tryRead("<!ELEMENT")) {
parseElementdecl();
} else if (tryRead("<!ATTLIST")) {
parseAttlistDecl();
} else if (tryRead("<!ENTITY")) {
parseEntityDecl();
} else if (tryRead("<!NOTATION")) {
... |
9fe97080-857a-4852-9569-19853a3c9b38 | 5 | private static double estimateBias(double E, byte w) {
int idx = (int)(w - MIN_P);
double[] red = rawEstimateData[idx];
double[] bd = biasData[idx];
if(E <= red[0]) {
return bd[0];
}
if(E > red[red.length - 1]) {
return 0.0;
}
for(int i = 0; i < red.length - 2; i++) {
i... |
68d01f41-46da-4e58-82ec-a5e5134c328f | 1 | public static String getNextName(){
if(nextInt < firstAvail.length())
return firstAvail.substring(nextInt, ++nextInt);
return "$";
} |
aac1f17b-4b3b-4258-85cc-ade2b66fe8f3 | 8 | private String getTimeInterval() {
String timeInterval = "Hello";
Calendar midnight = Calendar.getInstance();
midnight.set(Calendar.HOUR_OF_DAY, 0);
Calendar noon = Calendar.getInstance();
noon.set(Calendar.HOUR_OF_DAY, 12);
Calendar midDay = Ca... |
35c07650-d61d-4942-89e7-15bda5e4e9c4 | 2 | public boolean isVassal(String playerName, String vassalName) {
boolean isvassal = false;
String SQL = "SELECT *" + " FROM " + tblAllegiance + " WHERE `player` LIKE ?" + " AND `patron` = ?";
try {
Connection con = getSQLConnection();
PreparedStatement statement = con.prepareStatement(SQL);
statement.s... |
8805cba7-7450-4efe-85e7-6ddeaadda8ae | 8 | private void calcLevels() {
int i;
if (!autoLevels)
return;
if (levels == null)
levels = new double[NLEVELS];
zrange();
if (logLevels) {
double inc = Math.log(zmax - zmin) / (levels.length + 1);
try {
for (i = 0; i < levels.length; i++)
levels[i] = zmin + Math.exp((i + 1) * inc);
}
... |
93098400-0b21-4801-99e2-5249e9dde3bb | 2 | @Override
public Object evaluate(Context context) {
Iterator<Term> i = terms.iterator();
Object value = i.next().operand.evaluate(context);
while (i.hasNext()){
Term next = i.next();
value = next.add
? Operations.add(value,next.operand.evaluate(context))
: Operations.sub(value,next.operand.... |
f7d2a051-4479-4209-9160-a5d5fdac8435 | 0 | public ClassVisitorImpl( final AnnotationHandlerBinderImpl binder )
{
this.binder = binder;
} |
428a8e45-63d5-4455-8c6b-4a68546c3641 | 0 | public void ajoutListeTags(Tag tag) {
listeTags.add(tag);
} |
ceb364cd-6e16-46c1-a8a2-48db6d7a4f3e | 4 | private void initMongo() {
if (initialized) {
if (mongo == null) {// init mongo error
throw new DataAccessException("创建mongo实例失败");
}
} else {
try {
mongo = new Mongo(host, port);
} catch (UnknownHostException e) {
LOGGER.error("创建mongo实例失败:", e);
} catch (MongoException e) {
LOGGER.e... |
27c018eb-704f-47a0-af1d-161ef23599c8 | 3 | public void send(Packet packet) {
if (channel == null || !channel.isConnected()) return;
ByteBuffer data = PacketCodecs.CLIENT_SERVER.write(packet);
try {
System.out.println("[Client] Sending to " + channel.getRemoteAddress() + ": " + packet);
channel.write(data);
} catch (IOException e) {
e.printStack... |
3c899830-d867-43d3-97dc-0b51dc77966b | 9 | public SimpleList<String> metropoliXMLStructure (){
try {
String path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path
+ "/xml/papabuilding.xml"));
DocumentBuilderFactory builderFactory =
Documen... |
0e578dca-9eb8-4e51-b085-771b10d22e27 | 1 | public ArrayList<Point> abstractSearch(ArrayList<Point> visited,
int size, boolean frontOrBack) {
// Get the most recently searched node in the visited list
Point head = visited.get(visited.size() - 1);
// If we haven't reached end of graph, continue searching
if (!(this.pos... |
e7bbe8e5-c631-4d22-ad5e-d0bedc20d750 | 1 | public boolean isGravityOnStatus() {
if(frame == null) buildGUI();
return gravityOnStatus.isSelected();
} |
a8fa04a3-06a6-4020-80b9-1d68f9f18f75 | 9 | public String parseCommand(String input)
{
String[] args = input.split("\\s+");
String command = args[0].toLowerCase();
String result = "";
switch (command) {
case "get":
result = getString(args);
break;
case "set":
result = setString(args);
break;
case "getbit":
result = getBit(args);
... |
921e8295-0e24-4005-b94b-9af059640972 | 0 | public Employee(String n)
{
name = n;
salary = 0;
} |
ce3e6ff9-6386-4db0-a10e-1b5addb7dfbe | 7 | public void modifyUser(String user, int accType){
Statement stmt = null;
/*if(user.equals(dbUser)){
JOptionPane.showMessageDialog(null, "Not modifying yourself, please" +
" use a different account with administrator credentials" +
" to modify \'"+user+"\''s user privileges.");
return;
}
THIS IS ... |
3fcd8d70-cbd1-48cf-acfe-f1e4f6eae557 | 6 | private boolean checkChar(char c) {
return (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c == ' ';
} |
47b550ee-fe2d-4b3d-b689-b92179f98585 | 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("]"))
... |
0a4a6b8c-c875-47c0-876e-8e7e8239461d | 7 | public static void main(String[] args) {
System.out.println("Gluon Compiler");
if (args.length == 0) {
// Print out help
System.out.println("Usage: GluonCompiler [-linux] <input_file> [output_file]");
//scanner = new GluonScanner();
} else {
... |
5aa1a107-a421-4734-918b-e3288708a52d | 9 | private void readDirectory() {
List<File> listfile = new ArrayList<File>();
File folder = new File(path+AppPaths.FILE_SEP);
File[] listOfFiles = folder.listFiles();
//compter les sous dossiers
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isDirectory()) {
listfile.add... |
fd590cdd-69f4-4421-a46c-639a947f209c | 7 | public void setSelectedOC(OutputConnector selectedOC, Component comp) {
if (this.selectedOC != null)
this.selectedOC.setSelected(true);
this.selectedOC = selectedOC;
this.selectedOC.setSelected(true);
connectables = new ArrayList<InputConnector>();
for (Component e : getElements()) {
if (e == comp)
... |
60ed8122-263b-4dc5-8c90-62d8a85f0496 | 2 | public float moveY(float amount) {
float newY = worldY + amount;
if (newY > maxOffsetY) {
float moved = maxOffsetY - worldY;
worldY = maxOffsetY;
return moved;
} else if (newY < minOffsetY) {
float moved = minOffsetY - worldY;
worldY =... |
526f538c-2edb-4a53-bf09-ac3df7efa110 | 2 | void consensusByCellType() {
for (String cellType : filesByCellType.keySet()) {
ArrayList<String> bedFiles = filesByCellType.getOrCreate(cellType);
if (verbose) Timer.showStdErr("Creating consensus for cellType '" + cellType + "', files: " + bedFiles);
RegulationFileConsensus regCons = readBeds(bedFiles, ce... |
9ce742b6-6b02-4d2d-8429-5a110ff078d9 | 3 | public CharController(String s) {
if (s != null) {
int diff = 4 - s.length();
if (diff > 0) {
for (int i = 0; i < diff; i++) {
s = s + " ";
}
}
s = s + " ";
characterArray = new Array7x7[s.length()];
theString = s;
}
} |
cf1ba234-851e-41c1-9817-c7e732e0510f | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((position == null) ? 0 : position.hashCode());
result = prime * result
+ ((setLength == null) ? 0 : setLength.hashCode());
return result;
} |
0e2ef9d8-fdb9-4c12-9198-7046cbed3839 | 3 | public void replace(String statement) throws CannotCompileException {
try {
replace2(statement);
}
catch (CompileError e) { throw new CannotCompileException(e); }
catch (NotFoundException e) { throw new CannotCompileException(e); }
catch (BadBytecode e) {
... |
831e0151-4cd9-49ec-ba51-6fd2cd5c324a | 6 | public ListNode swapPairs(ListNode head) {
ListNode header = new ListNode(0);
header.next = head;
// assert (head!=null && head.next!=null):"the number of nodes in list < 2";
if (head==null || head.next==null)
return head;
ListNode pre = header;
... |
5a89aa27-b040-4832-a044-cce00277d0ee | 1 | @Override
public void destroy() {
if(currentSector > -1) {
Application.get().getLogic().getGame().getSector(currentSector).releaseLocation(owner);
}
} |
42e042d5-608b-4d89-8ab6-e13dd3ec67a3 | 0 | @Before
public void setUp()
{
Guice.createInjector( new QuartzModule()
{
@Override
protected void schedule()
{
configureScheduler().withManualStart();
scheduleJob( TimedTask.class );
}
} ).getMembersInjector(... |
28fa5336-2434-4dae-8202-f628bfe8f4e9 | 0 | public Metadonnee getMetadonnee() {
return metadonnee;
} |
3db453ca-da4b-42af-a553-ffe2b906e715 | 2 | public static String getAppropriateForm(String in) {
String formTag;
if (in.equals("password"))
formTag = "password";
else if (in.contains("date"))
formTag = "date";
else
formTag = "text";
return formTag;
} |
cd347b11-5360-43cb-9fb5-5ae207278d04 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj instanceof MarketQuote) {
MarketQuote other = (MarketQuote) obj;
for (MarketQuotesResponseField f : MarketQuotesResponseField
.values()) {
if (this.hasField(f) == other.hasField(f) && this.hasField(f)) {
... |
24cea8d7-c0f8-4afe-ad96-6741a19f45f1 | 3 | public void fire() {
if(bulletCooldown > 0) return;
for (int i = 0; i < bullets.length; i++) {
if (bullets[i].alive){
continue;
}
bullets[i].alive = true;
bullets[i].x = x;
bullets[i].y = y;
bullets[i].speed = facingDirection * 10f;
bulletCooldown = 10;
return;
}
/*if(bullets.length ... |
07e94467-a911-471d-baf1-9fb61305af48 | 2 | public HelpPanel()
{
super(Constantes.HELP);
try {
editor = new JEditorPane(Main.class
.getResource("help/whatsnew.html"));
editor.setEditable(false);
editor.addHyperlinkListener(this);
popup = new ClipboardPopupMenu(fals... |
96a955d4-8af3-4d18-955b-ddaba64167e5 | 9 | public void generateTile(World world, Random rand, int x, int y) {
if(x > world.width / 2 || y < world.height / 2) return;
if(rand.nextDouble()*100 >= 0.5) return;
for(int r = rand.nextInt(5) + 5; r > 0; r--) {
for(int a = 0; a < 360; a++) {
double angle = Math.toRadians(a);
int nx = (int) (x ... |
4a9d59d7-2d5d-45b5-8428-0de732bfcf15 | 7 | public void paint(Graphics g)
{
JTextComponent comp = getComponent();
if (comp == null)
return;
int dot = getDot();
Rectangle r = null;
char dotChar;
try
{
r = comp.modelToView(dot);
if (r == null)
return;
... |
40e7871d-6902-4908-af3b-1da7de91aaaa | 1 | private void refreshTitle() {
if(statusOnline) {
setTitle(Constants.PROGRAM_NAME +" ("+settings.getLanguage().getLabel("status_online")+")");
} else {
setTitle(Constants.PROGRAM_NAME +" ("+settings.getLanguage().getLabel("status_offline")+")");
}
} |
0d3442c3-7244-41f9-95b4-90c6298ca446 | 0 | private void syncToDocumentSettings() {
docSettings.getLineEnd().restoreTemporaryToCurrent();
lineEndComboBox.setSelectedItem(docSettings.getLineEnd().tmp);
docSettings.getSaveEncoding().restoreTemporaryToCurrent();
saveEncodingComboBox.setSelectedItem(docSettings.getSaveEncoding().tmp);
docSettings.get... |
c12d09a0-d7f2-49d1-836c-c03c1847ed9b | 2 | private void ordenaPesquisa(String ordem, Criteria criteria) {
if (ordem != null || !ordem.isEmpty()) {
criteria.addOrder(Order.asc(ordem));
}
} |
8ac3899f-5795-4fd5-a9a4-c41359838f3d | 6 | @Override
public void actionPerformed(ActionEvent event) {
if (event.getSource().equals(greenColor)) {
color = Color.green;
}
if (event.getSource().equals(redColor)) {
color = Color.red;
}
if (event.getSource().equals(blueColor)) {
color = Color.blue;
}
if (event.getSource().equals(yellowColor)... |
29c7ddbc-6a5e-4df0-ab76-d602ce54c653 | 6 | public PnTabelaUtilizador(String linguagem) {
local = new Locale(linguagem);
this.linguagem = linguagem;
bundle = ResourceBundle.getBundle("linguagem.message", local);
utilizadores = new ListaUtilizadores();
//System.out.println("PnTabelaUtilizaodr: " + utilizadores.getLstUtiliza... |
da829e65-46d6-45f7-8bfc-e31d84e142c0 | 3 | public void testUndo() throws Exception {
us.add( e3 ).add( e1 ).add( e2 );
assertFalse( us.hasRedoElement() );
assertTrue( us.hasUndoElement() );
try {
us.getNextRedoElement();
fail();
}
catch( final NoSuchElementException expected ) {
}
assertEquals( e2, us.getNextUndoElement() );
assertTr... |
42d6f57f-eea7-4e1b-99da-339a65855166 | 6 | public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file = new File("C:/1.txt");
in = new BufferedReader(new FileReader(file));
String line;
int n = 0;
label: while ((line = in.readLine()) != null) {
for (int i = 0; i < line.length(); i++) {
boolean ... |
5790fed6-196c-4c13-8e1a-f2d435c2aac4 | 1 | public List<ComBenutzer> getAlleBenutzer() {
List<Benutzer> alleBenutzerListe = dbZugriff.getAlleBenutzer();
List<ComBenutzer> rueckgabe = new ArrayList<ComBenutzer>();
for (Benutzer benutzer : alleBenutzerListe){
rueckgabe.add(new ComBenutzer(benutzer.getBenutzername(), benutzer.getPasswort(), benutzer.getAk... |
553b493b-5593-4463-8284-2443dec5cbbb | 7 | @Override
public Integer insert(TipoMovimientoBeans tmovi) throws DAOException {
PreparedStatement pst = null;
ResultSet generatedKeys = null;
try {
pst = con.prepareStatement(sql.getString("INSERT_USUARIO"),
Statement.RETURN_GENERATED_KEYS);
pst.setInt(1, tmovi.getIdTipoMovimiento());
ps... |
f274d1f3-7d1e-4f8a-9332-60e19aac6cd7 | 4 | private boolean check(RationalNumber2 num) {
for (Integer x : primBrojevi) {
if(num.getNumerator() == 1){
return true;
}
if((num.getNumerator()%x==0) && (num.getDenominator()%x == 0)){
return false;
}
}
return true;
} |
69fb8636-3f74-4532-a81e-ed98eb02b502 | 3 | @Override
public ArrayList<String> getTerminationSprites() {
ArrayList<String> result = new ArrayList<String>();
if(stype1 != null) result.add(stype1);
if(stype2 != null) result.add(stype2);
if(stype3 != null) result.add(stype3);
return result;
} |
b8911cc6-e07b-4ae4-a7d9-39d30c0a9998 | 4 | public static int yDelta(int givenDirection)
{
switch(givenDirection)
{
case 0: return 1;
case 1: return 0;
case 2: return -1;
case 3: return 0;
default: throw new DirectionOutOfBoundsException();
}
} |
fa8a8976-378d-43bb-adc7-65407f3d4328 | 3 | public double[] do150baudFSKHalfSymbolBinRequest (CircularDataBuffer circBuf,int start,int bin0,int bin1) {
double vals[]=new double[2];
// Get the data from the circular buffer
double samData[]=circBuf.extractDataDouble(start,26);
double datar[]=new double[FFT_160_SIZE];
// Run the data through a Blackman wi... |
97ca9dbc-ec28-41fa-aba3-b2e4d21de919 | 3 | public static void main(String[] args) throws Exception{
String dictFile = "words.txt";
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
TopQueue topQueue;
long startTime;
long consumingTime;
if(args.length == 1) {
... |
93c771f3-c0af-49ca-bfc8-14258f821f36 | 0 | public String getStartTime ()
{
return startTime;
} |
71caf4b5-d8fa-4899-9327-aa29974f1902 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HandOff other = (HandOff) obj;
if (catcher == null) {
if (other.catcher != null)
return false;
} else if (!catcher.equals(other.catcher)... |
563a419b-48a1-4e2e-a958-cf470805d78e | 5 | public void tryToFill(){
if (!l.hasNext()) return; // if there is no line
for(int i=0;i<pumps.size();i++){
if (pumps.get(i).free()&&freeAttendant()){
Car c = l.next();
pumps.get(i).fill(c);
pumps.get(i).askAttendant(attendants);
if (c.getWaitTime()>19) late++;
... |
6229f718-034d-4a4b-bd05-17c845fdbf61 | 5 | public void go() {
new Thread(new Runnable() {
public void run() {
try {
for (SimonButton button : buttons) {
button.setEnabled(false);
/// button.removeActionListeners();
}
for (int button_num : computerButtonPresses) { // iterate through each sequence element
Thre... |
2f0b25cf-900f-4ef7-b2e9-97471d0f9a43 | 1 | private String readFile(File f) throws FileNotFoundException, IOException {
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
StringBuilder b = new StringBuilder();
String zeile;
do {
zeile = br.readLine();
b.append(zeile);
... |
742155cb-7b22-41d6-9f6c-4b3ba9958214 | 9 | public static String[] resolveJarsPaths(String root) {
if (root == null) {
return jarsPaths;
}
ArrayList jarList = new ArrayList();
StringTokenizer st = new StringTokenizer(root, ";");
while (st.hasMoreTokens()) {
if (quitResolving == true) {
break;
}
String fileName = st.nextToken().trim();
... |
ea70a12d-1835-4eec-bbfc-6d3d00ceb233 | 4 | private boolean endGame( Board board, int turnNumber){
if(board.numberOfEmpty() == 0 && triggerTurn == -1){ // Start end game
triggerTurn = turnNumber;
System.out.println("Start end counter");
}
if(triggerTurn != -1 && triggerTurn + (60000/Turn.TURN_DURATION)<turnNumber)... |
15905d21-4e5b-42d2-8c17-cc799413675f | 4 | public void frameRateManager()
{
if( lastFPS <=System.currentTimeMillis() )
{
fps=""+frames;
//System.out.println(fps);
lastFPS = System.currentTimeMillis() + 1000;
if(frames<80&&slp>0)
{
System.out.println("Low Frame Rate: "+fps);
slp--;
}
else if(frames>110)
{
System.out.print... |
88ca2a1f-c18b-487c-a17a-a3b695837e5c | 4 | private void nombreproveedoresFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nombreproveedoresFieldKeyTyped
// TODO add your handling code here:
if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar()))
... |
0556fad7-fcb4-4d5c-b3a5-585aabda40fc | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// It is assumed that entering the menu command without parameters is an
// attempt to get information about it. So let's give it to them.
if (args.length == 0) {
for (Map.Ent... |
72b682d9-f31e-4195-b936-d4abc3c1d09a | 7 | public static String payVault(Player p, int tier, double basepay, String job) {
double iTimes = tier;
String pLang = PlayerCache.getLang(p.getName());
String jobName = UpperCaseFirst.toUpperFirst(McJobs.getPlugin().getLanguage().getJobNameInLang(job, pLang).toLowerCase());
job = job.toL... |
e65ef5da-e381-411f-94e0-8ee3e6d7f44f | 4 | public TfDialog(String title, int dim, int oNum, List<Parameter> params, List<Parameter> sysParams) {
this.setTitle("Transfer Function for " + title);
this.setModal(true);
this.dim = dim;
this.oNum = oNum;
numFlds = new JTextField[oNum][dim + 1];
for (int k = 0; k < numFlds.length; k++)
for (int i = 0;... |
e1c41706-4266-4b0b-9a64-0bc26164300b | 9 | public static void main(String[] args) {
long count = 0;
for(int a8 = 0; a8 <=1; a8++){
for(int a7 = 0; a7 <=2; a7++){
for(int a6 = 0; a6 <=4; a6++){
for(int a5 =0 ; a5 <=10; a5++){
for(int a4 = 0; a4 <=20; a4++){
... |
80287a0d-1203-491f-b4a1-13b12be930cd | 6 | public int recursiveChop(int target, int[] dataSet) {
int arrayLength = dataSet.length;
if(dataSet.length == 0) {
return -1;
}
int arrayMiddle = arrayLength/2;
int middleValue = dataSet[arrayMiddle];
if (arrayLength == 1 && middleValue != target) {
return -1;
}
if (middleValue > target) {
i... |
2ae98a9c-aecb-49f2-9a9f-91f7f74aee1a | 1 | public List findByProperty(String propertyName, Object value) {
log.debug("finding Record instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Record as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.