method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
118e0b82-a8a2-4022-abac-8bfba28d4e97 | 4 | public int run(PrintWriter out, String[] args)
{
long maxNumber = Long.parseLong(args[1]);
if (maxNumber<1) return(ILLEGAL_PARAMETER);
out.println(args[0]+ ": Sequence up to " + maxNumber + " numbers");
if (maxNumber>=1) out.println(1);
if (maxNumber>=2) out.println(1);
long first = 1, secon... |
b9b4a1ce-0d07-458f-a1d8-af45bf881ea2 | 6 | private void getHorizontalAxis() {
int y = 0, y2 = 0;
try {
y = Integer.parseInt(listVarString.get("depart1").split(":")[1]);
} catch (NumberFormatException e) {
System.err.println(" depart 1 incorrect");
}
try {
y2 = Integer.parseInt(listVarSt... |
3571a54f-460a-4e9f-85da-5baba369d693 | 5 | private int calcCompability(String name1, String name2,
String surname1, String surname2){
char[] name1charArr = name1.toCharArray();
char[] name2charArr = name2.toCharArray();
char[] surname1charArr = surname1.toCharArray();
char[] surname2charArr = surname2.toCharArray();
int result = 100;... |
0a5c26d1-a28b-4dc9-9b9c-47c0d5310669 | 3 | public boolean equals(Quaternion r) {
return x == r.getX() && y == r.getY() && z == r.getZ() && w == r.getW();
} |
81d21cd9-b766-4348-bb0c-dc7647c68809 | 4 | static int getOffsetOfChunk(int []vsize, int[] csize, int []start)
{
int [] volume = new int [vsize.length];
int []dsize = new int [vsize.length +1];
dsize[vsize.length]=1;
volume[0]=1;
for(int i = 1; i < volume.length; i++)
{
volume[i] = volume[i-1]*vsize[i-1];
}
for(int i = vsize.length -1 ; i... |
a6156461-1b44-4775-942c-6b1e33030bc2 | 3 | public String toStringVisible(){
StringBuilder sb = new StringBuilder("[");
for (int i=0; i<cards.length; i++){
sb.append(exposed[i] ? cards[i] : "?");
if (i+1 != cards.length)
sb.append(", ");
}
sb.append("]");
return sb.toString();
} |
8b2a0663-b632-4908-bca5-25aa05cb8100 | 3 | private void updateStateEntry(List<Keyword> keywords, List<String> terms, List<String> approval) {
if (keywords == null || keywords.isEmpty()) {
DialogManager.giveDialogManager().setInErrorState(true);
}
//If User has History
if (!this.getCurrentSession().getCurrentUser().getUserData().getAcceptedSuggestions... |
a5401f48-f4b7-4279-aea4-c3deb9f8ac1c | 2 | public void ignoreFile(final LessFileStatus lfs) {
synchronized (WATCH_LOCK) {
filesWatcher.removeFile(lfs.getFrom());
filesWatcher.removeFile(lfs.getTo());
try {
if (!fIgnore.exists())
fIgnore.createNewFile();
BufferedWriter bw = new BufferedWriter(new FileWriter(fIgnore, true));
bw.append(... |
fee7d148-d6b2-44b9-9be3-3a905290f5cf | 5 | public boolean partialMatch(String search) {
int idx = 0;
if (search.length() == 0)
return true;
while(true) {
if ((idx = name.toLowerCase().indexOf(search.toLowerCase(), idx)) != -1) {
if (idx == 0 || name.charAt(idx - 1) == ' ') {
return true;
}
else {
idx++;
continue;
... |
999eda3e-f9b8-4ecf-8b91-6fbfc5d44cdd | 6 | @EventHandler
public void BlazeStrength(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.Strength.... |
38f341ae-7c37-42e7-a53f-8690cf9baf75 | 3 | protected void updateMenu(String[] comboboxEntries, final RightMenu menu) {
for (String s : comboboxEntries) {
this.rightPanelComboBox.addItem(s);
}
if ((this.rightPanelComboBox.getActionListeners() != null) && (this.rightPanelComboBox.getActionListeners().length > 0)) {
... |
a9effaf7-a451-4aa6-a94a-607dd34319b0 | 8 | @Override
public void render(int glMode) {
List<Morph> morphsToDraw = new ArrayList<>();
for (MorphType morphType : MorphType.values()) {
List<Morph> morphsByType = ship.getMorphsByType(morphType);
if (morphsByType != null) {
morphsToDraw.addAll(morphsByType);
}
}
int layer = 0;
Iterator<Morph>... |
e3900cc2-f1a6-472d-af98-55cf9249613f | 6 | public void getSoakingBonus() {
for (int i = 0; i < c.playerEquipment.length; i++) {
if (c.playerEquipment[i] > -1) {
for (int j = 0; j < Config.ITEM_LIMIT; j++) {
if (Server.itemHandler.ItemList[j] != null) {
if (Server.itemHandler.ItemList[j].itemId == c.playerEquipment[i]) {
for (int k = 0... |
22456d9a-1947-4789-8488-0747c33767ac | 1 | private Message normalMessage(Stat stat) {
Message msg = new Message();
String subject = stat.getName() + ": now is in normal state";
if (stat.getStateDescription() != null) subject += " (" + stat.getStateDescription() + ")";
msg.subject(subject);
addNameValue(stat, msg);
... |
bdd65b6f-5e47-4a00-802b-4ecd593d48b2 | 6 | private void handleString(String x){
//tests to see if the code matches some predefined server commands
if (x.substring (0, 5).equals ("serv."))
{
if (x.equalsIgnoreCase ("serv.dc")) ... |
36e98d68-3322-4df8-8382-8519599a5d6d | 0 | public void setPage(String page) {
this.page = page;
} |
56a7e73b-3bf2-455a-a525-0ff69cdfc681 | 4 | public int fromDegree(Object from, boolean excludeSameVertexEdges) {
if (!excludeSameVertexEdges)
return degree(from);
int count = 0;
Object[] vertices = verticesToNeighbors.keySet().toArray();
for (int i=0; i<vertices.length; i++)
if (hasEdge(from, vertices[i]) && !vertices[i].equals(from))
coun... |
83284683-4950-4276-9fcd-202c70c3068c | 7 | public static long determineGbPalette(long[] colors) {
long minCosts = Long.MAX_VALUE;
long minCostPalette = 0;
int minCostMethod = -1;
// Median Cut
{
long mcPalette = MedianCut.calculateGbPalette(colors);
long mcPaletteCost = ColorUtil.getCosts(colors, mcPalette);
long mcKmPalet... |
a5bb1c7e-e64c-430e-9324-41f7a3991135 | 3 | 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... |
23214be4-3eee-4351-985e-a9696233e413 | 8 | public List<Class<?>> getClassesFromJar(File file, ClassLoader classLoader)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
try
{
final JarFile jarFile = new JarFile(file);
Enumeration<JarEntry> enumeration = jarFile.entries();
while (enumerati... |
f013da07-dcf2-4ec2-ab4b-6372e945ebb7 | 4 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getSource() == vp_ui.btn_entity)
{
EntityUi entity_ui = new EntityUi();
entity_ui.setVisible(true);
String prev_code = vp_ui.ta_code.getText();
if(entity_ui.entity.name!=null)prev_code += entity_ui.entity.... |
51729219-b610-4584-9743-3e688ad14b70 | 5 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Position position = (Position) o;
return Objects.equal(position.getX(), this.getX()) && Objects.equal(position.getY(), this.getY... |
6f56aa4c-c4aa-4d07-8cfa-e22894fd53b0 | 7 | public InputStream downloadStream(FTPFile fromFile) throws IOException, FtpWorkflowException, FtpIOException {
PipedInputStream pis = new PipedInputStream();
class DownStreamingThread extends Thread {
FTPConnection connection;
FTPFile fromFile;
Piped... |
79fc15aa-7587-49e8-ad20-318ba86f3642 | 2 | public void SoloLetras(JTextField a) {
a.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
char c = e.getKeyChar();
if (!Character.isAlphabetic(c) && !Character.isLetter(c)) {
getToolkit().beep();
e.consume();... |
5a1eba09-e8d7-4a05-acfd-d786faf569dd | 9 | public static String encode(String s, int n) {
String converted = "";
n = n%26;
int index = 0;
while(index < s.length()) {
char curChar = s.charAt(index);
if ('a' <= curChar && curChar <= '... |
e69901ed-fdd7-4a31-a65c-161aec9e6e8a | 3 | public static OrderStatusType valOf(Character val) throws Exception {
if (val.equals(Process.getVal())) {
return Process;
} else if (val.equals(Finish.getVal())) {
return Finish;
} else if (val.equals(Void.getVal())) {
return Void;
}
throw new Exception("Kode tidak terdaftar");
} |
d86c6405-8c7c-44a9-9dfa-6be6b89a60dd | 9 | public static String getFormattedNumber(String telephoneNumber, String email) {
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
String defaultRegion = "ZZ";
if (email != null) {
defaultRegion = CountryUtil.getCountryCode(email);
}
try {
PhoneNumber numberObj = phoneUtil.parse(telephoneNumber,... |
2677abad-fb3c-43bf-a1f8-df9d5a1d6b5f | 3 | private DataMessage searchMessage(ArrayList<DataMessage> stored,
Address source, int seqNbr) {
Iterator<DataMessage> iter = stored.iterator();
while (iter.hasNext()) {
DataMessage dataMessage = iter.next();
if (dataMessage.getSequenceNumber() == seqNbr
... |
1d8fe828-bc98-4565-a420-756eb8cba586 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
31bd8d79-4f43-4b65-b26e-5676c54f0345 | 0 | public void windowIconified(WindowEvent e) {
System.out.println("Die Anwendung wurde maximiert...");
} |
7279bcdf-858f-404e-9963-da3012d6036b | 3 | private int updateNamn() {
int res = 0;
lblError.setVisible(false);
if (Validate.notOverSize(tfNyttNamn) && !Validate.tfEmpty(tfNyttNamn)) {
try {
DB.update("update anstalld set namn = '" + tfNyttNamn.getText() + "' where aid =" + selectedAnstalld);
re... |
b9fe4270-3bb8-4c6e-a5da-31e483a038fa | 5 | public static int[][] transpose(int[][] matrix){
//preconditions
if(matrix == null)throw new IllegalArgumentException("matrix must not be null");
for(int i = 0; i < matrix.length; i++){
if(matrix.length != matrix[i].length)throw new IllegalArgumentException("matrix must be square!");
}
int[][] newMatrix... |
5ea51427-d7fa-4880-9e88-9459aae8f0c9 | 3 | public boolean collide(Ball b) {
if (this == b) return false;
boolean closeEnougth = Math.abs(getPosition()-b.getPosition()) < (getRadius()+b.getRadius());
boolean approaching = getSpeed() > b.getSpeed();
if (b.getPosition() < getPosition())
approaching = getSpeed() < b.getSpeed();
retu... |
57839de4-3939-4738-b48e-4a6f7b63fbea | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
6ddc54b6-bdf9-4e09-a246-953b1cd4534e | 2 | public Fraction absolute(){
int num = getNumerator();
int denom = getDenominator();
if(num < 0) {num = getNumerator()*-1;}
if(denom < 0){denom = getDenominator()*-1;}
return new Fraction(num, denom);
} |
aa83e71f-0ec7-4c9e-b938-3c527b72a09d | 9 | @SuppressWarnings("fallthrough")
public BytesRef getMax() throws IOException {
long size = size();
if (size == 0) {
// empty: only possible from a FilteredTermsEnum...
return null;
} else if (size >= 0) {
// try to seek-by-ord
try {
TermsEnum iterator = iterator();
... |
fc360c00-6db4-411b-b4b5-3d8cde89d721 | 5 | @Override
public void draw(Graphics g, int offsetX, int offsetY){
int x = tileX - offsetX;
int y = tileY - offsetY;
if (x < -2 || x > 40 || y < -2 || y > 40){
onScreen = false;
return;
}
onScreen = true;
float tX = x * 16 + Settings.CAM_X + movingValueX;
float tY = y * 16 + Settings.CAM_Y + movingV... |
558dbd3a-2abe-48d3-85d8-91af2c266d10 | 5 | public LoginAdmin validateAndConvert() throws ValidointiPoikkeus {
Validator validator = new Validator();
if(username == null || username.isEmpty()) {
System.out.println("virhe: tyhjä käyttäjätunnus");
validator.addError("username", "Käyttäjätunnus ei saa olla tyhjä");
}
if(password == null || passw... |
12bf3fe0-11ad-4f5d-a916-6fc8c0899cf1 | 0 | public static void main(String[] args) {
Integer n1 = new Integer(47);
Integer n2 = new Integer(47);
System.out.println(n1 == n2);
System.out.println(n1 != n2);
} |
6c4d918f-46e3-4b7b-aa20-076c3e5e92c3 | 9 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext()... |
836bab6a-d62b-4295-816d-513546e9606a | 2 | public ValueType getValue(int place) throws NotExistException {
Iterator<ValueType> step = new ListIterator();
if (place <= count) {
for (int i = 1; i < place; i++) {
step.remove();
}
return step.next();
} else {
throw new NotExistE... |
f09b8f38-c512-4e23-9640-036d015a75ad | 0 | public void setCountry(String country) {
addressCompany.setCountry(country);
} |
b638da2c-18c5-4542-b43b-71f288ac7cae | 0 | public List<DoneQuestDTO> getSetDoneQuestDTO() {
return setDoneQuestDTO;
} |
dccdb1e8-fc2f-4c62-816e-fb6a10049064 | 3 | @Override
public boolean equals(Object obj)
{
if(obj == null) return false;
if(obj == this) return true;
if(obj instanceof CommunicationTypeProperty) {
return type == ((CommunicationTypeProperty) obj).type;
} else {
return false;
}
} |
6822bd08-4d15-4d42-84c2-30a3c1185aa5 | 5 | public void activateOptions() {
if (debug) {
System.out.println("Activate options");
}
if (buffertype.equalsIgnoreCase("autopop")) {
eventQueue = new Fifo(buffersize, Fifo.AUTOPOP);
} else if (buffertype.equalsIgnoreCase("refuse")) {
eventQueue = new Fifo(buffersize, Fifo.REFUSE);
} else {
event... |
20ceeee2-d445-43fc-b3a4-f5c60099b899 | 3 | @Override
public void handleEvent(Event event) {
switch (event.getType()) {
case "PlayerTurn":
// System.out.println("logic: player turn");
this.handlePlayerTurnEvent((PlayerTurnEvent) event);
break;
case "GameStatusUpdate":
this.handleGameStatusUpdate((GameStatusUpdateEvent) event);
break;
... |
a5dd67ee-4e2e-47fd-8af5-05de118d232b | 4 | public static void main(String... args)
{
File file = new File("./data/average.txt");
try
{
FileReader stream = new FileReader(file);
BufferedReader reader = new BufferedReader(stream);
String line;
double total = 0;
double count = 0;
int last = 0;
while ((line = reader.readLine()) != null)
... |
323c9219-db36-4c59-bae5-f9df9190cb2d | 0 | public int getState(Configuration configuration) {
return ((ConfigurationButton) configurationToButtonMap
.get(configuration)).state;
} |
464ad9cc-20d4-468b-9c4e-d80574fdd08c | 6 | @SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent e) {
if (Toolbar.CMD_PLAY.equals(e.getActionCommand())) {
if (simState == seqFinished) {
// clear map and replay simulation
mapEntries = (Vector<MapEntry>) mapEntriesReplay.clone();
mapEntriesReplay.clear();
try {
... |
3e1d455c-91a1-49f7-be44-cd9dce6b640e | 9 | public List<Integer> largestDivisibleSubset(int[] nums) {
LinkedList<Integer> res = new LinkedList<>();
if (nums == null || nums.length == 0)
return res;
Arrays.sort(nums);
int index[] = new int[nums.length];
int len[] = new int[nums.length];
Arrays.fill(len, 1);
Arrays.fill(index, -1);
for (int i = ... |
07e29aa2-4771-4ad1-b8c7-4ee821f01b7f | 1 | static Method[] getDeclaredMethods(final Class clazz) {
if (System.getSecurityManager() == null)
return clazz.getDeclaredMethods();
else {
return (Method[]) AccessController
.doPrivileged(new PrivilegedAction() {
public Object run() {
... |
74284a60-8a38-43e9-8082-6483eea8fce4 | 9 | public void fromXML(String xml,XMLNoteImageIcon.Provider prov) throws BadDocumentException {
//System.out.println(xml);
InputSource source=new InputSource(new StringReader(xml));
if (prov!=null) { _doc.setXMLNoteImageIconProvider(prov); }
boolean ignore=_doc.getUndoManager().setIgnore(true);
try {
SAXParse... |
f70563ff-ce42-4839-99c1-62dcc6ead841 | 3 | @Override
public void run() {
String serverAddress = SERVER_IP;
try {
Socket socket = new Socket(serverAddress, SERVER_PORT);
InputStream input = socket.getInputStream();
OutputStream output = socket.getOutputStream();
long startDate = System.current... |
69dabdde-4a14-418c-9b3e-6f4dcbb13d67 | 3 | public static int[] permutationByNumber(int n, long number) {
long[] fact = new long[n];
fact[0] = 1;
for (int i = 1; i < n; i++) {
fact[i] = i * fact[i - 1];
}
int[] p = new int[n];
int[] free = new int[n];
for (int i = 0; i < n; i++) {
fr... |
e33e2bea-e831-41f0-ae24-015de85f580b | 9 | final private int[] getFlags( Function f ) {
int[] rtn = new int[ 0 ];
if ( f instanceof Sine || f instanceof Cosine || f instanceof Tangent ||
f instanceof Cosecant || f instanceof Secant || f instanceof Cotangent ||
f instanceof Arcsine || f instanceof Arccosine || f instanceof Arctangent ) {
rtn = n... |
77157ddb-b589-46ab-b52f-c8d39061daff | 2 | private void poll() {
KeyState state=null;
do {
state=keyMapper.poll();
if (state!=KeyState.NONE) {
keyAffected(state);
}
} while (state!=KeyState.NONE);
} |
22b30d28-bd81-47de-bbbc-5e5235ad04de | 2 | public void run()
{
boolean incr = true;
while(true)
{
if(incr)
{
if(a.nFontSize < 30)
a.nFontSize++;
else
incr = false;
}
else
{
if(a.nFontSize > 12)
a.nFontSize--;
else
incr = true;
}
a.repaint();
try
... |
063db096-4ebd-4c4c-a8ba-f21152e4f527 | 6 | private boolean checkDomination(Label l1) {
// Can't be dominated if the label is the only one
if(labels.get(l1.getNode())==null) return true;
for(Label l2 : labels.get(l1.getNode())) {
if(l1.getDistance()>=l2.getDistance() && l1.getDanger()>=l2.getDanger() && (l1.getDistance()>l2.getDistance() || l1.getDan... |
60622c1d-fc18-4b24-ab20-5a693f639a6c | 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... |
cafa4947-f82b-485e-b642-0d15a72fbacb | 3 | private void empty() {
for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
if (wdg.visible && wdg instanceof Item) {
wdg.wdgmsg("drop", Coord.z);
}
}
} |
abee0237-0ece-4b97-8c3a-0ebe6ccf3ca4 | 2 | public void display(){
int tempIndex = reDrawIndex, count = 0;
do{
//Setting index to 0 when list goes out of bounds
if(tempIndex == listImages.size()){
tempIndex = 0;
}
// Setting position of next image
// Drawing next image
listImages.get(tempIndex).setPosition( (count*(s_W/5))+(... |
2db4ea18-c4de-4005-a30e-f79b4f6d3488 | 8 | public static void main(String[] args){
DummyPOJO dm = new DummyPOJO();
ArrayList<Method> setters=null;
ArrayList<Method> getters=null;
try {
setters = Introspect.getSetters(Introspect.getClass(dm));
getters = Introspect.getGetters(Introspect.getClass(dm));
} catch (NoClassFoundException e1) {
... |
d46fcf41-3c41-4d3b-b67e-c492f40dd7e2 | 0 | public String getTrainNumber() {
return this._trainNumber;
} |
0100d3a8-8891-41c2-91d1-67ead59bdf54 | 6 | @EventHandler
public void SlimeFastDigging(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.getSlimeConfig().getDouble("Slime.FastDi... |
a20f5595-4312-4d88-85da-365361236991 | 7 | @Override
public void mergeAuctioneerPolicy(Auctioneer A)
{
if (A == null)
return;
final DefaultAuctionPolicy base = new DefaultAuctionPolicy();
liveListPrice = base.liveListPrice;
timeListPrice = A.timedListingPrice() < 0.0 ? base.timeListPrice : A.timedListingPrice();
timeListPct = A.timedListingPct() ... |
34bc933f-1e08-4f9e-9e72-2d4ef15057ae | 4 | public static ArrayList<String> convertir(String a){
ArrayList<String> expresion = new ArrayList<>();
char[] xpres= a.toCharArray();
String numero="";
for (int i = 0; i < xpres.length; i++) {
if(Character.isDigit(xpres[i])||xpres[i]=='.'){
numero=numero+xpres[i]... |
64d68df4-6791-479f-b6a0-f22a424aaac4 | 6 | @EventHandler
public void onCommandPreEnter(PlayerCommandPreprocessEvent event) {
if(plugin.getConfig().getBoolean("EnableFakePluginList") == false) {
return;
} else {
if(event.getMessage().equalsIgnoreCase("/plugins") || event.getMessage().equalsIgnoreCase("/pl")) {
if(!event.getPlayer().hasPermission("... |
01a98eec-58ba-48c7-acdf-bd066f37916b | 5 | private void normalizePoint(int x, int y)
{
double normalizedCharge=0;
if (_field[x][y].getVal()>0)
{
normalizedCharge=_field[x][y].getVal()/_maxPotential;
}
else
{
normalizedCharge=_field[x][y].getVal()/Math.abs(_minPotential);
}
double magnitude=_field[x][y].getVector().getAbs();
if (magnitud... |
61c4d089-015b-479e-92fe-84a394afd599 | 8 | private static void startServer() {
logger.info("Starting stand-alone server.");
try {
final FreeColServer freeColServer;
if (FreeColDirectories.getSavegameFile() != null) {
XMLStream xs = null;
try {
// Get suggestions for "sin... |
4dbff2a5-a4dd-43ff-a627-217f45592a0c | 4 | private List<File> listFilesForFolder(final File folder) {
List<File> ret = new ArrayList<File>();
if (folder.listFiles() == null) {
if (processTrayIcon != null){
processTrayIcon.displayMessage("Connection Error Message", "Could not find folder " + folder,
TrayIcon.MessageType.ERROR);
return null;
... |
9387476d-d1b1-4f7e-a939-ac1cc38c0015 | 5 | public void reduceAP(MapleClient c, byte stat, short amount) {
MapleCharacter player = c.getPlayer();
switch (stat) {
case 1: // STR
player.getStat().setStr(player.getStat().getStr() - amount);
player.updateSingleStat(MapleStat.STR, player.getStat().getStr());... |
41bf9d62-d9f7-43de-8637-5c26e2151cc4 | 1 | public void addStuff()
{
this.removeAll();
this.add(name);
this.add(keywords);
this.add(attackTypeParameter1);
this.add(attackTypeParameter2);
this.add(typeLevel);
this.add(flavor);
this.add(newParam);
this.add(delParam);
for(int i = 0; i < body.toArray().length; i++)
{
BodyParam ... |
706041f2-d4d9-45fc-b2ca-b5637829d2d8 | 3 | @Override
public void publish(LogRecord record)
{
if( getFormatter() == null )
setFormatter(new SimpleFormatter());
try
{
String message = getFormatter().format(record);
if( record.getLevel().intValue() >= Level.WARNING.intValue() )
{
... |
dc20ac74-93d5-4fe3-bf44-9d67f95ad48b | 4 | public static void cutText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
// Abort if node is not editable
if (!currentNode.isEditable()) {
return;
}
// Copy Text
String text = textArea.getSelectedText();
if (text != null) {
j... |
4be45f41-adef-4ed7-b1ba-b679136d1d96 | 1 | private void addDb(Attributes attr) {
try {
this.bd.add(new BancoDados(attr));
/*
BancoDados tmp[] = this.bd;
bd = new BancoDados[tmp.length + 1];
System.arraycopy(tmp, 0, bd, 0, tmp.length);
bd[tmp.length] = new BancoDados(attr);
... |
71cb3039-47f6-4287-997a-058696af4584 | 5 | public static int Ingresar() {
do {
tc = 0;
salp = 0;
System.out.println("Codigo: ");
String Cod = LeerT.Leer();
if (Cod.equals("0"))
return 0;
System.out.println("Nombre: ");
String Nombre = LeerT.Leer();
System.out.println("Fecha: ");
String Fecha = LeerT.Leer();
System.out.print... |
d4b18e4e-9c05-4c55-88bb-3e4459e490c8 | 8 | private void clickHexagon( int i, int j )
{
if ( PresentacioCtrl.getInstancia().consultaEstatPartida() == EstatPartida.NO_FINALITZADA &&
( PresentacioCtrl.getInstancia().esTornHuma() || !partida_en_curs ) )
{
try
{
//No ens cal comprovar si el moviment es fa o no (si retorna true o false).
Pre... |
0b1bb3a5-8548-4234-b698-7c5f27641e20 | 5 | public void setUserEnrolledCourseField(String field, String value) {
if (field.equals("id")) setId(Long.parseLong(value));
if (field.equals("fullname") && !value.equals("")) setFullName(value);
if (field.equals("shortname") && !value.equals("")) setShortName(value);
} |
2c3da375-1ec1-4165-80a8-b3e510f67c97 | 2 | public static AbstractTile getTile(int uniqueID){
if (uniqueID <= tiles.size() && tiles.get(uniqueID) != null){
return tiles.get(uniqueID);
} else {
System.out.println("Tried to access an ID not bound to a tile");
System.out.println(String.valueOf(uniqueID));
return tiles.get(0);
}
//return null;... |
fa41194f-0977-49d6-9359-849c260a4d00 | 6 | public synchronized void actionPerformed(ActionEvent e) {
Object target = e.getSource();
// /#endif
if (target == startButton) {
// /#ifdef AWT10
// / startButton.disable();
// /#else
startButton.setEnabled(false);
// /#endif
decompileThread = new Thread(this);
sourcecodeArea.setText("Please... |
2915254e-dc2f-4beb-9f88-476e57b8d013 | 5 | private void showSelectedOrder(SessionRequestContent request) {
String selected = request.getParameter(JSP_SELECT_ID);
Order currOrder = null;
if (selected != null) {
Integer idOrder = Integer.decode(selected);
if (idOrder != null) {
List<Order> list = (L... |
2eab2d4f-6a7b-435b-8c0a-9a63193da8e1 | 7 | private final boolean cons(int i)
{ switch (b[i])
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
case 'y': return (i==0) ? true : !cons(i-1);
default: return true;
}
} |
eb005575-9a66-46b1-ad9a-e1821467ac11 | 2 | private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
if (cmbBuscaFuncionario.getSelectedItem().equals("Selecione")) {
JOptionPane.showMessageDialog(null, "Erro selecione o departamento",
"Departamento", JOptionPane.ERRO... |
be62810e-d275-42ac-ba1b-4e0b6bef0f5d | 1 | public void run() {
while(true)
evenIncrement();
} |
8aff5f81-a439-4293-92e2-8594d38cca61 | 6 | public List<Expression> combine(Expression expression) {
List<Expression> allCombinations = new LinkedList<Expression>();
List<Expression> leftCombinations = left.combine(expression);
for ( Expression leftExpression:leftCombinations ) {
if ( operator == Operator.DIVIDE && right.eval().equals(0) )
continue... |
22e5255d-5385-4e07-875f-a17641dbd83c | 9 | public void visitFieldInsn(
final int opcode,
final String owner,
final String name,
final String desc)
{
mv.visitFieldInsn(opcode, owner, name, desc);
if (constructor) {
char c = desc.charAt(0);
boolean longOrDouble = c == 'J' || c == 'D';
... |
263185c0-7e43-4c1b-be80-9b544ee890f5 | 6 | public void addAuthHeader(int cust_id,String token)
{
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
2a239d1b-334c-4f56-9796-6ea0be0ace4a | 5 | private void laboratorioperteneceFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_laboratorioperteneceFieldKeyTyped
// TODO add your handling code here:
if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar())... |
9b23a6e2-4f3e-4709-8b1f-2fc62d9c4827 | 9 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
if (ServletFileUpload.isMultipartContent(req)) {
Deck deck = new Deck();
// Create a factory for disk-based file items
DiskFileItemFactory factory = new DiskFileItemFactory();
// Set factor... |
660a76be-c3bd-4842-9583-a61b3f9851d8 | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((answere == null) ? 0 : answere.hashCode());
result = prime * result
+ ((answereInfo == null) ? 0 : answereInfo.hashCode());
result = prime * result
+ ((catagory == null) ? 0 : catagory.h... |
f398500c-a9a5-4e36-82e0-8399ba6ac352 | 8 | public synchronized int getFramePosition(int x, int y) {
if (getCorner(TOP | LEFT | CORNER).contains(x,y)) {
JShot.debug("TOP | LEFT | CORNER");
return TOP | LEFT | CORNER;
} else if (getCorner(TOP | RIGHT | CORNER).contains(x, y)) {
JShot.debug("TOP | RIGHT | CORNER");
return TOP | RIGHT | CORNER;
} ... |
8a5860b6-adaa-47b9-b719-e7b2ffeac773 | 7 | private boolean syncSequenceHunt(CircularDataBuffer circBuf,WaveData waveData) {
int pos=0,b0,b1;
int f0=getSymbolFreq(circBuf,waveData,pos);
b0=getFreqBin();
// Check this first tone isn't just noise the highest bin must make up 10% of the total
if (getPercentageOfTotal()<10.0) return false;
pos=(int)sampl... |
0d2ef0f7-2f85-4e64-882c-e57f13528526 | 3 | private void addBranchElement(Document doc, Element linesElement, FileData fileData, int i, Element lineElement) {
if (fileData.getBranchData().keySet().contains(i)) {
List<BranchData> branchDatas = fileData.getBranchData().get(i);
if (lineElement == null) {
lineElement =... |
9082712c-99d2-43c2-9e6d-00418ef12c5c | 4 | private void setHeaders(String url, PostParameter[] params, HttpURLConnection connection, boolean authenticated, String httpMethod) {
log("Request: ");
log(httpMethod + " ", url);
if (authenticated) {
if ( oauth == null) {
}
String authorization = null;
... |
72e101fc-5bf8-4337-9076-8e29d59d98d0 | 0 | @Override
public String introduceYourself() {
return "MultipleChoiceQuest";
} |
a9ce2c51-38c1-4688-baae-9c76b4fd9b1c | 2 | public String connect_url(String uri) {
String result = "";
try {
URL url = new URL(uri);
//File f = new File("Kana_Hanazawa");
URLConnection urlc = url.openConnection();
BufferedReader buffer = new BufferedReader(new InputStreamReader(urlc.getInputStream(... |
88737a07-dd67-4be8-8aff-3ab9cab2d03f | 5 | public static Object[] reprodukcja(ParamSpec ps, Unit[] oldpop) {
Unit[] newpop = new Unit[oldpop.length];
int mate1 = 0, mate2 = 0, popsize = oldpop.length;
String s1 = null,s2 = null;
Object[] obj = statystyki(oldpop);
oldpop = (Unit[])obj[0];
double[] stat... |
9164bd85-0632-423c-85ea-6be12abd2caa | 1 | private File createNewSettings(String in)
{
File def = new File(plugin.getServer().getPluginManager().getPlugin(in.substring(0, in.length() - 4)).getDataFolder(), "settings");
if(!def.exists())
def.mkdir();
String settingsName = in.substring(0, in.length() - 4).toLowerCase() + "-... |
9cf0bf75-7602-4643-8f60-7456021aecd0 | 5 | private ArrayList<Solution> dispatchAlgorithms(Solution solution, Set<Algebra> states){
ArrayList<Solution> solutions = new ArrayList<Solution>();
//iterate over algorithms
//keep a list of all smarts, along with the respective algorithm and tree
ArrayList<AbstractMap.SimpleEntry<Integer, AbstractMap.SimpleEntr... |
8f670b03-6873-4025-8119-58f0cd3b8e9c | 2 | private void mode(String mode) {
if((mode == "") || (last != mode))
save();
last = mode;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.