method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
468a40e2-54b3-4065-a9d9-a4a8d09ca403 | 9 | public ArrayList<CheckOut> getIsbnCheckOuts(long[] bookIsbnArray) throws Exception {
if(bookIsbnArray == null || bookIsbnArray.length == 0){
return null;
}
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
ArrayList<CheckOut> checkOutList = new ArrayList<CheckOut... |
c91b2381-1c94-48c0-a984-6458aa45eccf | 9 | public void incr(int num) {
if (useTreeMap) {
final Integer key = num;
Integer val = map.get(key);
if (val == null) {
map.put(key, 1);
} else {
map.put(key, 1+val);
}
return;
}
if (upto == values.length) {
values = ArrayUtil.grow(values, 1+upto);
... |
650b246e-3f77-47ec-8c70-a67a03b5aa03 | 1 | private void incrementHunger()
{
setFoodLevel(getFoodLevel() - 1);
if(getFoodLevel() <= 0) {
setDead();
}
} |
ad0bd821-464d-42bc-b84b-1daeb2193932 | 2 | public PasteDialog(IRCMainFrame owner, String chan) {
super(owner, true);
setTitle("Paste Dialog - "+ chan);
this.mainFrame = owner;
this.chan = chan;
JButton okay = new JButton("OK");
JButton cancel = new JButton("Cancel");
okay.addActionListener(new ActionListener() {
public void ac... |
3d2c6dc3-1a89-4e43-951b-e6977c3216f0 | 5 | private void shortestPathQueueInsert(Path newPath) {
Path temp = null;
for (Path p : pQueue) {
if (p.getEndNode().getLabel() == newPath.getEndNode().getLabel())
temp = p;
}
if (temp == null) {
// Path not in the queue
// add new path
pQueue.add(newPath);
} else if (temp != null && (temp.getC... |
cae5c98f-f551-4f92-81ef-7d0c5a5b9ab3 | 0 | public FactoryMethodTest() {
} |
883a90e4-83c5-4236-83e1-b7acf09dd817 | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
FileWriter fw = new FileWriter("C:/windows/journal.txt");
BufferedWriter out = new BufferedWriter(fw);
out.write(jTextField2.getText());
out.newLi... |
547e4858-3c9e-43ed-b5f5-47cc548bf3ad | 2 | public String addRecipe() {
if (recipe != null) {
try {
restClientBean.getRecipeClient().createRecipe(recipe);
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
} |
4ecaa9c0-ff03-4f6d-8b30-9795d38761bd | 3 | public void updateTitle()
{
JFrame frame = (JFrame) SwingUtilities.windowForComponent(this);
if (frame != null)
{
String title = (currentFile != null) ? currentFile
.getAbsolutePath() : mxResources.get("newDiagram");
if (modified)
{
title += "*";
}
frame.setTitle(title + " - " + appTit... |
49ce1911-cbf4-4dde-b3d1-38cd445c1656 | 8 | public static String reverseVowels(String s) {
if (s == null)
return "";
char chars[] = s.toCharArray();
int i = 0, j = s.length() - 1;
while (i <= j) {
while (i < s.length() - 1 && !isvowel(s.charAt(i)))
i++;
while (j >= 0 && !isvowel(s.charAt(j)))
j--;
if (i < s.length() && j >= 0) {
c... |
02536aab-e9d9-499a-9ecb-a3ce0feeac03 | 9 | @Override
public void keyReleased(KeyEvent e) {
Type type = null;
boolean playerMoved = false;
if(e.getKeyCode() == ControlCommands.JUMP.getKey()){
type = Type.PLAYER_JUMP;
playerMoved = true;
}else if(e.getKeyCode() == ControlCommands.UP.getKey()){
... |
f6d4c6f8-e643-4552-ba8d-c0519e5615a5 | 2 | public void receive(final PacketHandler handler) {
receive = new Thread("receive_thread") {
public void run() {
while(running) {
byte[] buffer = new byte[1024];
DatagramPacket dgpacket = new DatagramPacket(buffer, buffer.length);
try {
socket.receive(dgpacket);
} catch (IOExcept... |
b2680606-f0c5-489d-88f9-e11964a9f8e9 | 0 | @Override
public String getDesc() {
return "Gospel";
} |
de8a08a1-ff2c-4dac-bcb2-c99f35479b58 | 4 | private int findPosition(LinkedList list, long startTime)
{
int index = 0;
// if the waiting list is empty, then add to it straightaway
if (list.size() == 0) {
return index;
}
Iterator it = list.iterator();
ResGridlet rgl = null;
// iterates a l... |
9b829cb7-c88e-4991-bb5a-1ad56e9415fd | 3 | protected void wireAllLayers() {
LayerIterator iter = new LayerIterator(this);
List<? extends Neuron> inputLayer;
List<? extends Neuron> outputLayer = iter.next();
while (iter.hasNext()) {
inputLayer = outputLayer;
outputLayer = iter.next();
wireLayers(inputLayer, outputLayer);
}
} |
d8c18c52-ce26-4688-a1e9-01c1d221acfa | 2 | private String getHost() {
if (Signlink.mainapp != null) {
return Signlink.mainapp.getDocumentBase().getHost().toLowerCase();
}
if (super.frame != null) {
return "runescape.com";
} else {
return super.getDocumentBase().getHost().toLowerCase();
... |
f61b2793-3fd2-4076-84a1-998fd867514e | 4 | private DbPoolConfig fetchConfig(Integer serelNo){
DbPoolConfig singleConfig = new DbPoolConfig();
String name =null;
String driver =null;
String url =null;
String user =null;
String passWord =null;
String minConns =null;
String maxConns =null;
String maxFreeInterval =null;
String type = null;
... |
1b30ce3a-29ed-4aae-892e-6aa05238a20e | 3 | @Override
public String strip(String s) throws Exception {
byte[] oldBytes = s.getBytes(WINDOWS1251);
byte[] newBytes = new byte[oldBytes.length];
int newlen = 0;
for (int j = 0; j < oldBytes.length; j++) {
byte ch = oldBytes[j];
if (!(ch >= 0 && ch < 32)) {
... |
4ac139c8-c0a6-4c23-ac7a-c5ecf3d16dd0 | 3 | public void setEqualizer(Equalizer eq)
{
if (eq==null)
eq = Equalizer.PASS_THRU_EQ;
equalizer.setFrom(eq);
float[] factors = equalizer.getBandFactors();
if (filter1!=null)
filter1.setEQ(factors);
if (filter2!=null)
filter2.setEQ(factors);
} |
8331c56b-8738-48f1-a339-5a66bc13f1e2 | 1 | public List<String> getInformations()
{
List<String> tmp = new ArrayList<String>();
for (int i = 1; i < informations.size(); i++)
tmp.add(informations.get(i));
return tmp;
} |
47c11dfe-a9d4-42c9-ab0b-1d2db4c266e1 | 6 | public String getPlayerMapView(int orgID){
String dataAsString = "";
String orgWorld = org.getWorld(orgID);
for(int i=0; i<lookup.playerViewYSize; i++){ // The y length
for(int j=0; j<lookup.playerViewXSize; j++){// The x length
int tempX = org.getX(orgID) - lookup... |
3eee141d-6c5b-4074-a553-57303bd6820c | 4 | @Override
public void mutate() {
//pick an agent to mutate
AgentParams toMutate = myGenerator.extractRandomAgent();
//switch((int)(0)) { //pick a parameter to mutate (adding/removing an agent has smaller possibility)
toMutate.agentType.mutate();
switch((int)(Math.random()*2))... |
794ab30a-84fa-440b-a76e-7d1501eccd84 | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
setUser((User) session.get("User"));
Criteria ucri = myDao.getDbsession().createCriteria(User.class);
ucri.add(Restrictions.not(Restrictions.eq("e... |
ec21eec1-e645-4c3e-b100-564115460f5b | 7 | public boolean hasDrug(Player targetPlayer){
Inventory inv = targetPlayer.getInventory();
if(inv.contains(Material.SUGAR) || inv.contains(Material.NETHER_STALK) || inv.contains(Material.PUMPKIN_SEEDS) || inv.contains(Material.WHEAT) || inv.contains(Material.MELON_SEEDS) || hasItem(targetPlayer, Material.INK_SACK... |
247c3d4d-a708-49cf-a1ac-f601ca2e15d7 | 6 | public void setInfile(String directory,String filename){
infile=new File(directory,filename+".mmap");
if(infile.exists()){
try {
FileReader fr=new FileReader(infile);
BufferedReader br=new BufferedReader(fr);
String s="",temp="";
while(temp!=null){... |
68e1d292-4c23-4e65-993a-754110564d23 | 7 | public List<StudentObj> getStudentByType(String classname, int objId, int topicId, int pass) {
List<StudentObj> items = new LinkedList<StudentObj>();
String sql = "select Student.classname, Student.rollNo, fullname, email, mark from Student inner join Result on Student.rollNo = Result.rollNo inner join ... |
935c6626-5e31-44ab-ad42-4b3618792f1f | 2 | private void insert(K nieuw, int links, int rechts) {
K m;
while (rechts - links > 1) {
int midden = (links + rechts) / 2;
m = elementAt(midden);
if (nieuw.toString().compareTo(m.toString()) <= 0) {
rechts = midden;
} else {
links = midden;
}
}
add(rechts, nieuw);
} |
d5715bab-f953-4c70-91ee-84244b9b79be | 1 | public void visit_iushr(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
441fd0c9-ded7-432f-8969-5446539a9b96 | 7 | @Override
public String getColumnName(int column){
String name = "??";
switch (column){
case 0:
name ="Produkt Id";
break;
case 1:
name ="Produkt Navn";
break;
case 2:
name ="Fare Nivaue";
break;
case 3:
name ="Fremstillings Faktor";
break;
case 4:
name ="Fremsti... |
96590e96-1c58-4db9-bc71-05a3cdf3a82e | 5 | private static Method checkForCleanupMethod(Method m) {
if(m.getAnnotation(TestObjectCleanup.class) == null)
return null;
if(!m.getReturnType().equals(void.class))
throw new RuntimeException("@TestObjectCleanup " +
"must return void");
if((m.getModifiers() &
java.lang.reflect.Mod... |
720fcac7-984e-4577-9a4c-393b3345d0d0 | 6 | @Override
public String convertToGeneralForm(String monom) {
if (!monom.contains("x")) {
monom = monom + "x0";
}
if (monom.contains("x") && (monom.length() == monom.indexOf("x") + 1)) {
monom = monom + "1";
}
if (monom.indexOf("x") == 0) {
monom = "1" + monom;... |
aead84a9-1c51-4992-943a-fcab44246917 | 6 | @Override
public WorldObject[] getObjects(int plane, int localX, int localY) {
int currentChunkX = localX / 8;
int currentChunkY = localY / 8;
int rotation = regionCoords[plane][currentChunkX][currentChunkY][3];
int realChunkX = regionCoords[plane][currentChunkX][currentChunkY][0];
int realChunkY = regionCoo... |
6d268a7c-d24e-42c8-99a5-77cdc6e7352f | 9 | public int maximalRectangle(char[][] matrix){
if(matrix == null || matrix.length == 0 || matrix[0].length ==0)
return 0;
int cols = matrix[0].length;
int rows = matrix.length;
int[][] h = new int[rows][cols];
int max = 0 ;
int area= 0;
for(int i=0 ; i<... |
73f082b5-2caf-4465-81a9-a54af46116ae | 0 | public DrawingPanel() {
setBackground(Color.WHITE);
} |
41a0c9e5-bc93-4577-8539-abc59450cc2a | 6 | public static String Map2JSON(Map<?,?> map) {
String output = "";
output = output + "{";
for (Map.Entry<?, ?> e : map.entrySet()) {
if (output.length() > 1) output = output + ",";
String key = json_escape(String.valueOf(e.getKey()));
String value = json_escape(String.valueOf(e.getValue()));
output = o... |
3f830242-c854-4622-b33c-8d8c9a99aa03 | 3 | public void setArmorContents(ItemStack[] contents)
{
for (int i = 0; i < Armor.length; i++)
{
if (i < contents.length && contents[i] != null)
Armor[i] = contents[i].clone();
else
Armor[i] = null;
}
} |
92266e98-9996-41dc-8fd5-093ab05e138d | 5 | public static void main(String[] args)
{
if (args.length == 1)
{
try
{
timeTCP(args[0]);
}
catch (IOException e)
{
e.printStackTrace();
System.exit(1);
}
}
else if... |
fa1402c2-4585-4421-86f0-3e946d7eae18 | 3 | @Override
public GameState doAction(GameState state, Card card, int time) {
if(time == Time.DAY)
{
state = carpenterDay(state, card);
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
state = temp.doAction(state, card, time);
}
else if(time == Time.NIGHT)
{
// Do nothin... |
0e20e0ae-22e9-4cf1-97b9-45808516d18b | 2 | public void visitOuterClass(String owner, String name, String desc) {
super.visitOuterClass(remapper.mapType(owner),
name == null ? null : remapper.mapMethodName(owner, name, desc),
desc == null ? null : remapper.mapMethodDesc(desc));
} |
6cecbcfa-b2a0-479a-870f-8a04b20478a0 | 6 | @Override
protected void paintComponent(Graphics gc) {
super.paintComponent(GraphicsUtilities.prepare(gc));
Rectangle clip = gc.getClipBounds();
Insets insets = getInsets();
int height = getHeight();
Rectangle bounds = new Rectangle(insets.left, insets.top, getWidth() - (insets.left + insets.right), height -... |
e6da7cda-a3cc-4dc7-b38a-97a0d53a20c1 | 4 | public void setExpAux(List<?> list)
{
for(PExpAux e : this._expAux_)
{
e.parent(null);
}
this._expAux_.clear();
for(Object obj_e : list)
{
PExpAux e = (PExpAux) obj_e;
if(e.parent() != null)
{
e.parent()... |
c791f134-39f7-436a-9a9d-c6e803af04e1 | 8 | public boolean isCompatible(AstType type)
{
if (type.isANumber())
{
AstType newType = resultantType(type);
return !newType.isUndefined();
}
if (isSet() && type.isSet())
{
if ((getSetType().getType() == TYPE_EMPTY) ||
... |
cf58dfd0-c091-4626-9aab-5e16f2a612ba | 0 | public static String getIdentityHexString(Object obj) {
return Integer.toHexString(System.identityHashCode(obj));
} |
a93601f3-e2f6-413a-9ec6-e6d8ce9cc602 | 1 | @Override
public void setExp(int exp) {
if (exp < this.nextExp) {
this.exp = exp;
}
} |
2001b306-10f6-47f3-89ac-f6224e44db73 | 8 | public void handle(Callback[] callbacks) throws
UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback) {
NameCallback nc = (NameCallback) callback;
nc.setName(nc.getDefaultName());
... |
c52a174e-b1e4-43a7-a1cd-30bf22b4fa18 | 3 | private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a' ? "Misplaced endArray." :
"Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
} catch (IOEx... |
b136f964-d6bc-4ddc-a4de-1de194b130af | 4 | private static void readTrainingDataAndMatch(TreeMap<Long, User> testDataMap) throws IOException {
System.out.println("Start Reading Training Data And Match");
BufferedReader fileReader = new BufferedReader(new FileReader(trainingDataDirectory));
BufferedWriter outputWriter = new BufferedWriter(new FileWriter(ou... |
7dd47670-04a7-464a-bb32-6ca44ac56920 | 3 | public EventManager() {
helpButton = new JLabel("<html><a href=\"#\">Help</a></html>");
helpButton.setAlignmentX(SwingConstants.RIGHT);
helpButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); //link
helpButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent ... |
b31cf439-3fc6-44a8-a547-2b0421cd424a | 6 | public SymbolGraph(String filename, String delimiter) {
st = new ST<String, Integer>();
// First pass builds the index by reading strings to associate
// distinct strings with an index
In in = new In(filename);
while (in.hasNextLine()) {
String[] a = in.readLine().sp... |
487e7b35-88e3-43a0-af6a-75bb05042f77 | 3 | protected void mouseClicked(int var1, int var2, int var3) {
if(var3 == 0) {
for(int var4 = 0; var4 < this.controlList.size(); ++var4) {
GuiButton var5 = (GuiButton)this.controlList.get(var4);
if(var5.mousePressed(this.mc, var1, var2)) {
this.selectedButton = var5;
... |
b570ee2b-8212-447d-a039-98007f17c0de | 7 | @SuppressWarnings("unused")
public static void installRegistryKeys(ArrayList<String> selectedExts, boolean uninstall)
{
ArrayList<String> fileTypes = new ArrayList<String>();
String jarPath = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
if (!jarPath.conta... |
31887701-89fa-4454-8ff1-78559f3220be | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReplLocationError that = (ReplLocationError) o;
if (from != null ? !from.equals(that.from) : that.from != null) return false;
if (to != null ? ... |
6c6d2a57-7052-4ae8-af39-9b7084c172a1 | 7 | public void handle(Object javaBean, JSONVisitor visitor) {
Class<?> clazz = javaBean.getClass();
init(clazz);
JSONOutputVisitor outputVisitor = (JSONOutputVisitor) visitor;
outputVisitor.print('{');
outputVisitor.incrementIndent();
boolean first = true;
Map<Str... |
973888e3-82b6-4393-875a-d0d4374a2e45 | 3 | public static void main(String[] args) throws IOException
{
CommandLine cmd = getArgs(args);
String path = cmd.getArgs()[0];
System.out.printf("File: '%s'%n", path);
BufferedImage image = ImageIO.read(new File(path));
Collection<Circle> circles = CircleDetection.detect(im... |
0b0d2013-805b-4ec9-ae01-1ecde5734c15 | 2 | private void doUp() {
switch (marioObject.getDirection()) {
case LEFT:
super.setAnimation(UpLeft);
break;
case RIGHT:
super.setAnimation(UpRight);
break;
}
} |
43f30589-d714-43b1-8938-6cd60a1a2591 | 9 | private FileStore(File directory) throws Exception {
int filesLoaded = 0;
for(File file : directory.listFiles()) {
if(file.isFile()) {
if(file.getName().equals("main_file_cache.dat2")) {
dataFile = new RandomAccessFile(file, "r");
} else {
if(file.getName().startsWith("main_file_cache.idx")) {
... |
f2a30e10-cc4d-41b9-b195-e3d927f656d8 | 3 | public static void readRTF(String url) throws IOException {
FileReader rtfReader = new FileReader(url);
BufferedReader bufferedRTFReader = new BufferedReader(rtfReader);
try {
while (true) {
String line = bufferedRTFReader.readLine();
if (line == nul... |
95fc81e8-3fed-47f7-bcfa-b75417b743b6 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
ecedd049-8e83-4e73-a5cf-8a7d27c62251 | 5 | private final boolean method2216
(Object object, boolean bool, Class var_class, String string)
throws IllegalAccessException, NoSuchFieldException {
try {
if (bool != true)
method2217(4, -90, 15);
anInt5048++;
Field field = var_class.getDeclaredField(string);
return field.getBoolean(object);
}... |
a34efd4e-fba7-4208-8d5f-1f3c63b4c2ac | 2 | private void accountForStates(HashSet states) {
Iterator it = states.iterator();
while (it.hasNext()) {
State state = (State) it.next();
if (!STATES_IN_A_SET.contains(state))
STATES_IN_A_SET.add(state);
}
} |
919f31dd-82dd-4797-9231-8d06c252aeae | 0 | public City(int IDNumber, int xLocation, int yLocation, Owner owner){
this.xLocation = xLocation;
this.yLocation = yLocation;
this.IDNumber = IDNumber;
this.owner = owner;
} |
94a9440b-35b8-4c1e-a730-a022ad54d88c | 0 | public Player(int x, int y)
{
super(x, y);
StepCounter = 0;
direction ='^';
URL loc = this.getClass().getResource("/karel/themes/LTTPUp.png");
ImageIcon iia = new ImageIcon(loc);
Image image = iia.getImage();
this.setImage(image);
} |
63603ddc-e621-4c4a-8ffb-7c63b4080616 | 7 | public boolean equals(Settings other) {
return ((logIntervalMS == other.logIntervalMS) && (heightUnits == other.heightUnits)
&& (batteryType == other.batteryType) && (lowVoltageThreshold == other.lowVoltageThreshold)
&& (batteryMonitorCalibration == other.batteryMonitorCalibration) && (logServo == other.logSe... |
aef63231-3de9-497a-bed6-662023ccfe87 | 9 | public void creat(List[] input,String strFileName) throws RowsExceededException, WriteException, DocumentException{
try {
String newFile = strFileName.substring(0, strFileName.length()-4);
System.out.println("newfile"+newFile);
WritableWorkbook book = Workbook.createWorkbook(new File(newFile+... |
9dbfb871-97ce-4534-bb5d-86a272a6c170 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JSONArray other = (JSONArray) obj;
if (values == null) {
if (other.values != null)
return false;
} else if (!values.equals(other.values)... |
b4293a41-ada4-47c6-9ea6-9f9eaedba416 | 9 | private void openImageFile() {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
if (f == null) {
return false;
}
if (f.isDirectory()) {... |
55d634f2-fe97-4863-a758-37df05c4612c | 5 | public void displayLCS()
{
System.out.println("Length of Longest Common Sequence is "+
length[seq1.length-1][seq2.length-1]);
LinkedList<Integer> list = new LinkedList<Integer>();
int row = seq1.length-1, col = seq2.length - 1, temp = -1, index = -1;
whil... |
ddf0a1c4-8d4a-443e-a64c-43cb66bb46ec | 7 | public void removeAnnouncement(CommandSender sender, Integer id) {
if (id > this.announcements_global.size() - 1 || id < 0) {
sender.sendMessage(FontFormat.translateString("&7No announcement exist with id: &a" + id));
return;
}
ListIterator<String> listIterator = this.announcements_global.listIterator();
... |
63f2c805-10f5-4b71-b88d-e097b42914bd | 1 | @Override
public boolean action() throws JSONException {
/*
* "action": { "cont": "", "text":
* "Auch wenn es Bogdan nicht gerne sieht: Du verkaufst Rubbellose zu Gunsten der Aktion Morgenwind. Deine Einnahmen erreichen bereits am ersten Tag:"
* , "bonus": "1", "gold": 1702, "klatschen": 5 },
*/
JSONOb... |
5ad9acb3-a072-4fca-afd2-6f612e7aee0c | 5 | public static void main(String[] args) throws IOException
{
if(args.length != 2 || args[0].equalsIgnoreCase("help"))
{
System.out.println("Argument is empty! Please provide the path of the input.txt");
System.out.println("Red_Black_Trees Path/to/input.txt Path/to/output.txt");
return;
}
FileOutputS... |
c302df5a-ff35-4dbd-b5be-78a8ae7c5d3a | 7 | @Override
public void run() {
if(!this.inFlight) // initial
{
calcGetsLost();
exchangeTransitions(Statics.RX_HELI);
stopDbDiscoverer();
waitForTakeOff();
depart();
} else {
getLost();
}
while(this.inFlight)
{
long timeMillis = System.currentTimeMillis();
try {
Thread.sleep(1... |
e374987b-4a31-4de7-9356-9192bf95548e | 9 | public static int getwordlen(TreeMap<Integer,Integer> m1,int n){
int sum=0;
int t=n/1000;
if(t>0)
sum+=m1.get(t)+m1.get(1000);
n%=1000;
int h=n/100;
if(h>0)
sum+=m1.get(h)+m1.get(100);
n%=100;
if(((h>0)||(t>0))&&(n>0))
sum+=3;
if((n>=10)&&(n<=20))
sum+=m1.get(n);
else{
int tens=n... |
5054c286-3889-4056-bd66-5ca67f008ecd | 3 | protected void processInput()
{
for(InputEvent e : Listener.universal)
{
if (e instanceof KeyEvent)
{
processEvent((KeyEvent) e);
}
else if (e instanceof MouseEvent)
{
processEvent((MouseEvent) e);
}
e.consume();
Listener.universal.removeEvent();
}
} |
005197b7-99f5-4c23-8d17-cf4d97df737f | 3 | private void respondToRequest(Request request) {
if (request.getCommand().equals("rebind")) {
System.out.println(String.format("handling request %s from %s:%d", request, request.getHost(), request.getPort()));
Reference reference = new Reference(request.getHost(), request.getPort());
... |
1ee8feda-d115-457c-ab75-1da379bd1c91 | 4 | @Override
public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
Object sel = lstStocks.getSelectedValue();
if (sel != null && sel instanceof Stock) {
btnOk.setEnabled(true);
}
else {
if (requiresStock) btnOk.setEnabled(false);
else btnOk.setEnabled(true);
... |
1a5cb74a-1c86-43e0-a504-0ff88b045ea8 | 1 | public E third() {
if (size() < 3) {
throw new RuntimeException("Third element not available");
}
return this.get(2);
} |
da4924dc-effa-46bb-aae4-5f1c627cd446 | 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 ... |
83b9411c-bce8-4586-9edf-c55c3848fa18 | 9 | @Override
public void run() {
dungeon.startup();
char read = '\0';
try {
while (dungeon.isActive()) {
if (read == '\n' || read == '\r') {
command = inputBuffer.toString();
dungeon.takeAction(command);
inputBuffer = new StringBuffer();
} else if (read == '\u007f') {
printOutputStrea... |
527cf3d4-2a9b-4eeb-9afb-19bb2955dc84 | 2 | private int[] getNodeIndexList(
DefaultMutableTreeNode node )
{
LinkedList<Integer> list = new LinkedList<Integer>();
while ( !node.isRoot() )
{
list.addFirst(new Integer(node.getParent().getIndex(node)));
node = (DefaultMutableTreeNode) node.getParent();
}
int n = list.size();
int[] nodeList = new int[n];
... |
8d0f886d-5516-443c-a4b5-3786cecc3cd8 | 8 | public void putSubImage(int x, int y, ImageAccess input){
if (input == null)
throw new ArrayStoreException("putSubImage: input == null.");
if (x < 0 )
throw new IndexOutOfBoundsException("putSubImage: x < 0.");
if (y < 0)
throw new IndexOutOfBoundsException("putSubImage: y < 0.");
if (x >= ... |
34e315c7-0628-4009-94d5-1524652f0fb7 | 6 | public static int getFirstK(int[] array,int start,int end,int k){
if(start > end){
return -1;
}
int midPos = start + (end - start)/2;
int midData = array[midPos];
if(midData == k){
if( (midPos != 0 && array[midPos-1] != k )|| midPos == 0){
return midPos;
}else{
end = midPos -1;
}
}
... |
f01f01f7-58be-4938-9e4c-a4cc72133654 | 0 | private void foo() {
Engine e = getEngine();
} |
9884c975-b335-4fd0-92c9-3ab331b804f3 | 0 | public MonitoredDiskFileItem(String fieldName, String contentType, boolean isFormField, String fileName, int sizeThreshold, File repository, OutputStreamListener listener)
{
super(fieldName, contentType, isFormField, fileName, sizeThreshold, repository);
this.listener = listener;
} |
a34ae0ad-f56b-4ed6-9747-ed0424283295 | 8 | public C64Test(String file) {
// System.out.println("Locale: " + l);
// Locale.setDefault(Locale.US);
// l = Locale.getDefault();
// Set the buffer for SID chip to lower than 1 second...
SIDMixer.DL_BUFFER_SIZE = 16384;
monitor = new Debugger();
// monitor.setEnabled(true);
cpu = ne... |
8c8e1f2f-62c7-4f53-ac55-c2196fb4def4 | 2 | @Override
public void mouseReleased(MouseEvent e) {
this.counter++;
if (this.cursorDragOn) {
this.counter = 9;
this.updateStatusAndCursor();
}
if (this.counter > 1) {
this.aCanvas.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
t... |
82329ab1-1524-4098-8d72-c6d4ca8d12c6 | 9 | private void storeStrings(ClassNode node) {
ListIterator<MethodNode> mnli = node.methods.listIterator();
while (mnli.hasNext()) {
MethodNode mn = mnli.next();
if (mn.name.equals("<clinit>")) {
ListIterator<AbstractInsnNode> ainli = mn.instructions.iterator();
... |
35cdf358-91a7-4dc5-91b7-c423959a4bf1 | 0 | public int getSouth(){
return this.south;
} |
6d3d41fc-22eb-4776-bf79-8f90a5660280 | 8 | public double[] getVotesForInstance_ori(Instance inst) {
DoubleVector combinedVote = new DoubleVector();
DoubleVector confidenceVec = new DoubleVector();
double[] ensembleVotes = new double[inst.numClasses()];
double qbcEntropy = 0.0;
int success = 0;
double confidence = ... |
94d6658f-393d-4f17-bd8e-19a8502232bf | 5 | public static Map<String, Object> defaultSerialize(Object o) {
Map<String, Object> data = new HashMap<String, Object>();
data.put("T", "L");
Map<String, Object> classesData = new HashMap<String, Object>();
data.put("data", classesData);
Class<?> clazz = o.getCla... |
138a4413-24e8-406e-a2ee-0bd805348564 | 1 | @Test
public void getIngredient_by_nonexistent_name_should_fail(){
Ingredient c = rep.getIngredient("BÉPOÈDLJAUIE,CTNS'RTÀY.KQGF");
if(c != null){
Assert.fail();
}
} |
e9aaa0a1-b8d9-4998-a1d7-d7f78202996a | 6 | public void setElementsToMagneticLine(MagneticLine magneticLine){
ArrayList<ComplexElement> complexElements = new ArrayList<ComplexElement>();
if(this.graph instanceof PetriNet){
PetriNet petri = (PetriNet)this.graph;
for (Place element : petri.getListOfPlaces()) {
... |
a94c8105-48a6-41ba-aabc-dd84aaec84a3 | 8 | public Player(Socket inSocket, DuskEngine inEngine)
{
try
{
qMessage = new FifoQueue();
SendThread st = new SendThread(this);
thrSend = new Thread(st);
thrSend.start();
bytObjType = (byte)0;
Type = 0;
engGame = inEngine;
ID = engGame.getID();
sckConnection = inSocket;
sckConnection.se... |
ccb9c315-9244-45a3-a7c3-bb9737c06170 | 5 | public void doAction(String value) {
char choice = value.toUpperCase().charAt(0);
while (choice != 'A' && choice != 'B' && choice != 'C' && choice != 'D') {
System.out.println("Invalid selection");
choice = getInput().toUpperCase().charAt(0);
}
if (choice == 'A')... |
e516629d-41df-47c9-8f92-7291bdf90fae | 5 | public String getProperty(String var) {
for (String line : this.lines) {
if (line.trim().length() == 0) {
continue;
}
if (line.charAt(0) == '#') {
continue;
}
if (line.contains("=")) {
int delimPosition ... |
a2e930f4-c054-4565-b5e8-1da54da64808 | 7 | private boolean isVerticalWin(int player) throws Exception {
boolean result = false;
String playerSymbol;
if ((player < 0) || (player > TicTacToeBoard.PLAYER_O)) {
throw new Exception("Invalid player index -- must be 0 or 1");
}
if( player == PLAYER_X) {
playerSymbol = X;
} else {
playerSymbol = O;... |
f9906db2-3a33-454a-9303-92396e94b13b | 3 | public void update()
{
RegularPumpingLemma pl = (RegularPumpingLemma)myLemma;
stageMessages[0].setText("File loaded.");
updateTopPane(false);
int[] decomp = pl.getDecomposition();
if(decomp[0] == 0 && decomp[1] == 0)
return;
myWDisplay.setText(pl.getW());
... |
99b5c69c-7a37-4ed5-909d-5f7d96c0b7fc | 5 | public void setKey(int k, boolean pressed) {
switch(k){
case KeyEvent.VK_UP:
if(pressed)
return;
break;
case KeyEvent.VK_DOWN:
break;
case KeyEvent.VK_RIGHT:
break;
case KeyEvent.VK_LEFT:
break;
}
} |
6093aae4-fb6d-49a2-8590-aa341ad64cc8 | 4 | @Override
public void write( Writer writer )
throws IOException {
writer.write( '[' );
ListIterator<JSONValue> iter = this.list.listIterator();
int i = 0;
while( iter.hasNext() ) {
JSONValue v = iter.next();
if( i > 0 )
writer.write( "," );
writer.write( " " );
// Silently... |
87c466c7-2d4a-4371-bd3b-8ae25c18a3b9 | 8 | public static Spell loadSpell(String ref) {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/spells"));
String line;
while((line = reader.readLine()) != null) {
String[] temp = line.split(";");
if(temp[0].ma... |
d8906901-dff4-4f21-8a8d-267eb5955e8a | 9 | public Line2D.Double getClippedLine(Line2D.Double line) {
if (isInside(line.x1, line.y1) && isInside(line.x2, line.y2)) {
return line;
}
if (isInside(line.x1, line.y1) == false && isInside(line.x2, line.y2) == false) {
return null;
}
if (line.x1 != line.x2 && line.y1 != line.y2) {
return null;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.