method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6b1fa7ca-e742-4c6f-89f6-f082726961a5 | 3 | private static String getClassName(String tester, Path path, String pkgName) {
StringBuilder sb = new StringBuilder();
boolean isLast = true;
for (int i = path.getNameCount() - 1; i >= 0; i--) {
String string = path.getName(i).toString();
if (Objects.equals(tester, string)) {
break;
}
if (isLast) ... |
46133d11-0bf0-4b6c-8cfa-cb3cb94c7645 | 4 | public static void save() {
FileWriter out = null;
try {
createParameterFilePath();
out = new FileWriter(new File(parameterFilePath));
ParameterCode[] codes = ParameterCode.values();
for (int i = 0; i < PARAMETER_COUNT; i++) {
saveParameter(out,codes[i]);
if (i != PARAMETER_COUNT-1)
out.wri... |
7aa576c6-4376-4b6f-a10f-412351b12cb0 | 9 | public static void rezeptInhaltAusgeben(Rezept rezept){
// Ausgaben Allgemeine Informationen
System.out.println();
System.out.println("Rezeptname: " + rezept.getRezeptname());
System.out.println("------------------------------");
System.out.println("Kategorie: " + rezept.getKategorie());
if(re... |
9d7c725b-4268-4b21-94f7-8ad470b100a4 | 2 | public boolean pressedOnce(int keycode) {
boolean isPressed = pressed(keycode);
boolean wasCheckedBefore = oncepressedSet.contains(keycode);
if (isPressed)
oncepressedSet.add(keycode);
return isPressed && !wasCheckedBefore;
} |
55ae5c99-61df-4dcd-bcd8-d2ad121b5f48 | 7 | public static void setupmidi() {
// This sets up the sequencer,
// populates the list of instruments available
// on the synthesizer, and does the initial
// tuning of the synthesizer.
// The synthesizer is set up when we create kbPanel
// in createGUI().
try{
// For now we'll just use the default
// s... |
96ee4a02-80b0-4474-9e03-b975487d6cd3 | 5 | public void work(){
if(!isDragged){
if(!isUnderGroundLevel()){
velocity.y += (termVelocity-velocity.y)*acceleration;
}
else if(isUnderGroundLevel()){
velocity.y *= -1*bounceFactor.y;
position.y = Constants.ScreenY - 2*radius;
... |
eab486ce-99a2-44cb-8136-accae84b2249 | 4 | public String ls() {
File folder = new File(currentDirectory);
File[] list = folder.listFiles();
StringBuilder builder = new StringBuilder();
for(File x : list) {
builder.append(" ");
builder.append(x.getName());
}
if (list.length != 0) {
... |
211f7741-198d-4714-9e12-280153f46a46 | 4 | @Override
protected final void enter(boolean enter) {
if (enter) {
this.state.object = this.object;
if (this.object != this.state.dragging) {
mark(enter);
}
} else {
this.state.object = null;
if ((this.state.dragging == null)
|| (this.state.dragging != this.object)) {
mark(false);
}
... |
8d6db8cb-ca5e-4963-94fc-3a9b554ae358 | 8 | public static DNA createDNAFrom35Strand(String dna) {
if (dna == null)
return null;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < dna.length(); i++) {
char n = dna.charAt(i);
if (n == ' ')
continue;
if (n == 'N') {
int nt = (int) Math.round(4 * Math.random());
switch (nt) {
... |
01df96ea-528d-4e25-9d95-aa0d471b83f9 | 6 | private static Socket parseArgs(String[] args) {
if (args != null && args.length == 2) {
String host = args[0];
int port = -1;
try {
port = Integer.parseInt(args[1]);
if (port < 0 || port > 65535) {
throw new NumberFormatException();
}
} catch (NumberFormatException ex) {
System.out.f... |
110e5728-b6ab-472a-b0c2-cb98cfec0ea6 | 0 | @Override
public void shuffle(){
} |
42ba2399-a781-4062-bcbf-054db4f6aff2 | 3 | public static void main(String[] args) {
// 1 Retrieve a LdapContextSource
ContextSource ldapContextSource = null;
try {
ldapContextSource = LdapContextSourceFactory.getLdapContextSource();
} catch (Exception e) {
System.out.println("Impossible to get a LdapContextSource.... |
394e2b29-64d6-4882-bb61-a25aea8dbbc2 | 7 | public void fileReplicationTransfer(ArrayList<String> fileList)
{
synchronized(fileList)
{
try
{
for(String file : fileList)
{
File f = fileManager.getSystemFile(file);
try
{
if(f.isFile())
{
Node ownerNode;
try
{
NodeManagerInter... |
e8b88b23-da0b-4663-84c3-06e267cd0504 | 3 | public void init(Bilgisayar b){
lblMasaAdi.setText(b.getMasaAdi());
pnlSureEkle.setVisible(false);
if(b.getAcilisSaati()!=null){
if(b.getSureSiniri()!=0){
lblKalanSure.setText(Long.toString(b.getSureSiniri() - b.gecenDakikaHesapla())+" dk");
... |
2950134e-8162-4ad3-90b1-3a376be10da6 | 7 | public static ErrorCode parse(byte[] data) throws MessageAttributeParsingException {
try {
if (data.length < 4) {
throw new MessageAttributeParsingException("Data array too short");
}
byte classHeaderByte = data[3];
int classHeader = Utility.oneByteToInteger(classHeaderByte);
if ((classHeader < 1) ... |
760a9ee0-5e1d-41e2-a5fc-0139b5a9a006 | 8 | public boolean[] annoutate(double[] docConcept) {
boolean[] fired = new boolean[concepts];
PriorityQueue<State> waiting = new PriorityQueue<SpreadingActivation.State>();
for (int i = 0; i < docConcept.length; i++)
if (isFired(docConcept[i]))
waiting.add(new State(docConcept[i], i));
while (!waiting.is... |
bb9caa77-57eb-406e-898f-be1bbe14f9fa | 2 | public Coord size() {
if (res.get() != null) {
Tex tex = res.get().layer(Resource.imgc).tex();
if(tex == null)
return new Coord(1, 1);
else
return tex.sz().div(30);
} else {
return new Coord(1, 1);
}
} |
3c930bff-899b-43da-b3c6-0b02c2dda6f6 | 9 | public void bestPages(String query){
DecimalFormat fmt = new DecimalFormat("0.00");
double [] common = new double [docCount];
double [] docSpecific = new double [docCount];
double [] simValues = new double [docCount];
double queryWeights=0;
double tfidf = 0;
Query search = new Query(termIndex);
for (Ter... |
7b8d961d-6634-42ae-bb67-8289cd6945eb | 1 | @Override
public String execute() {
IUnitOfWork unitOfWork = (IUnitOfWork) commandParameter.getSessionAttribute(ApplictionResources.getTransactionTokenKey());
String firstName = (String) commandParameter.getRequestAttribute(CONTACT_FIRST_NAME_ATTRIBUTE);
String lastName = (String) commandParameter.getRequ... |
43a81459-30c4-47a3-b9ba-0295d5fd397d | 2 | void close() {
try {
// Close if already closed yet.
if (raf != null) {
raf.close();
raf = null;
}
file = null;
} catch (IOException e) {
throw new RuntimeException(e);
}
} |
dbd1a972-31b4-41d7-88d1-a68d6d2160da | 2 | private synchronized int count_consoles(int servers) {
int consoles = 1;
if (servers > 15) {
consoles = servers / 15;
if (servers % 15 > 0) {
consoles++;
}
return consoles;
} else {
return consoles;
}
} |
126365dc-a57e-4d59-96c8-8c280a4d589f | 9 | public void work2(int v,int destnation){
boolean used[]=new boolean [nodelen];
//every site pass this route's cost
int price[][]=new int[nodelen][routelen];
int pre[]=new int[nodelen];
for(int i=1;i<nodelen;i++){
used[i]=false;
pre[i]=0;
}
used[v]=true;
pre[v]=v;
for(int i=1;i<=nodelen;i++)if... |
c0b1afcd-a736-4df4-aa9e-71af712fad0a | 5 | public void recevoir(Information<Float> information) {
informationRecue = information;
if (information.iemeElement(0) instanceof Float) {
int nbElements = information.nbElements();
float[] table = new float[nbElements];
for (int i = 0; i < nbElements; i++) {
table[i] = information.iemeElement(i);
}
... |
ac9cd1c4-c20d-4fc6-949b-3fd35d615fbe | 3 | public void remove(Course[][] courses)
{
System.out.println();
System.out.print("Enter semester to remove: ");
int semester = scan.nextInt();
System.out.print("Enter course to remove: ");
int course = scan.nextInt();
if( semester > courses.length || course > courses[semester].length || courses[semester][co... |
b0c7d4c2-57c5-4ecb-8b27-e5ab15e07cf6 | 7 | @Override
public void actionPerformed(ActionEvent e)
{
JButton buttonPressed = (JButton) e.getSource();
String id = buttonPressed.getText();
switch (id)
{
case "Sound Off":
soundButton.setIcon(soundOff);
soundButton.setText("Sound On");
soundButton.setToolTipText("Sound On");
... |
357eaaff-19e6-458c-ac3d-c57cf5cb2b5f | 9 | public void renderScreenImage(Graphics g, Dimension size, Rectangle clip) {
if (isTainted || getSlabEnabled())
setModelVisibility();
isTainted = false;
if (size != null)
setScreenDimension(size);
setRectClip(null);
int stereoMode = getStereoMode();
switch (stereoMode) {
case JmolConstants.STEREO_DOU... |
6e73f7ff-c59d-4159-8801-d1bf43e27e8f | 3 | private void mergeManagement(List<Dependency> target, List<Dependency> management) {
resolveVersions(target, management);
nextParentDep: for (Dependency parentDep: management) {
for (Dependency dependency: target) {
if (dependency.equalsIgnoreVersion(parentDep)) {
... |
26effba2-6fb1-4ced-8eea-9b748ee27ef6 | 7 | protected boolean isMine(Environmental host, Rideable R)
{
if(host instanceof Rider)
{
final Rider mob=(Rider)host;
if(R==mob)
return true;
if(mob.riding()==null)
return false;
if(mob.riding()==R)
return true;
if((((Rider)R).riding()==mob.riding()))
return true;
if((((Rider)mob.ri... |
cab52ce3-519a-4285-8b33-98067b745e50 | 8 | public void keyPressed(int k){
if (k == KeyEvent.VK_S){
bgm.stop();
player.setDirectionsFalse();
gsm.setState(GameStateManager.SAVESTATE);
}
if (k == KeyEvent.VK_M){
Globals.setGameMuted(!Globals.getGameMuted());
if (!Globals.getGameMuted()){
bgm.loop();
}
else{
bgm.stop();
}
... |
4e27cadc-1aee-4d29-96be-d02b20304d6a | 5 | public void crawl(int levelsNumber) throws IOException {
if (levelsNumber < 1) {
System.out.println("----------------------------------------------------------------------------------------------------------------------------");
return;
}
BufferedReader input = null;
try {
URL url = new URL(this.a... |
3e589c69-752b-4ce5-8d70-fbe0d22480df | 3 | public static Set<String> getMissingSteps(String featurePath, String stepPath, String... otherStepPaths) {
// This function greatly ressembles the method-implementing one, except that
// instead of actually implementing the methods, we simply collect the steps
// that they would implement
... |
d7c63c36-37c8-43a3-ab77-79178311f7ab | 1 | public void addUniform(String uniform) {
int uniformLocation = glGetUniformLocation(program, uniform);
if (uniformLocation == 0xFFFFFFFF) {
System.err.println("Error: Could not find uniform: " + uniform);
new Exception().printStackTrace();
System.exit(1);
}
... |
bba170eb-1a21-4255-b9fb-cfb6ed882217 | 4 | private void loadID3v2(InputStream in)
{
int size = -1;
try
{
// Read ID3v2 header (10 bytes).
in.mark(10);
size = readID3v2Header(in);
header_pos = size;
}
catch (IOException e)
{}
finally
{
try
{
// Unread ID3v2 header (10 bytes).
in.reset();
}
catch (IOExcepti... |
42150229-0fe7-4c68-b2e8-aceff517dcdb | 4 | @Override
public void undo() {
if (oldKey == null) {
if (newKey == null) {
// Do Nothing, since this should never happen.
} else {
tree.removeAttribute(newKey);
}
} else {
if (newKey == null) {
tree.setAttribute(oldKey, oldValue, oldReadOnly);
} else {
if (!oldKey.equals(newKey)) {
... |
a960cc83-96f8-4504-af02-f54a9eb05e38 | 4 | public static void main(String args[])
{
String filename = "Ratespiel.java";
if(args.length > 0) {
filename = args[0];
}
String out = read_String(filename);
int laenge = out.length();
int[] zeichen = new int[128];
int i;
for(i=0;i<laenge;i++) {
zeichen[(int)out.charAt(i)]++;
}
System.out.prin... |
1141a258-f381-4228-a627-f59029edf285 | 8 | private static Camera makecam(Class<? extends Camera> ct, String... args)
throws ClassNotFoundException {
try {
try {
Constructor<? extends Camera> cons = ct
.getConstructor(String[].class);
return (cons.newInstance(new Object[] { args }));
} catch (IllegalAccessException e) {
} catch (NoSuc... |
c5a26158-6553-491c-ac89-ab5b3610021d | 6 | public static float combatStrength(Actor actor, Actor enemy) {
float strength = 0 ;
strength += (actor.gear.armourRating() + actor.gear.attackDamage()) / 20f ;
strength *= (1 + (actor.health.maxHealth() / 10)) / 2f ;
strength *= (1 - actor.health.injuryLevel()) ;
strength *= 1 - actor.health.stressP... |
28f71514-5980-40d7-a474-da902b68e72b | 5 | public int GetCLHitpoints(int ItemID) {
if (ItemID == 10725) {
return 100;
}
if (ItemID == 10727) {
return 100;
}
if (ItemID == -1) {
return 1;
}
String ItemName = GetItemName(ItemID);
if (ItemName.startsWith("Hitpoints cape")) {
return 100;
}
if (ItemName.startsWith("Hitpoints hood")) {
re... |
75f78224-619c-494d-a325-7ae36c056a10 | 1 | public void setImage(BufferedImage newImage)
{
if (newImage != null)
this.setIcon(new ImageIcon(newImage));
} |
6708d240-1e47-442f-ad64-9548f7940933 | 2 | public static boolean startsWithIgnoreCase(final String stringToCheck, final String prefix) {
if (prefix.length() == 0) {
throw new IllegalArgumentException("Prefix may not be empty");
}
final int prefixLength = prefix.length();
if (stringToCheck.length() < prefixLength) {
return false;
}
return str... |
a1ab0f57-e5f5-4827-b940-7eb05d8cdcca | 9 | private static void handleStreams(final Process p, final OutputStream outStream, final OutputStream errStream, final InputStream inStream) {
//Handle Output
Thread outThread = new Thread(new Runnable() {
public void run() {
try {
InputStream pOut = p.getInputStream();... |
ef40cecf-ac23-4cc6-8173-cc746a5f750e | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Conta other = (Conta) obj;
if (this.IdConta != other.IdConta && (this.IdConta == null || !this.IdConta.eq... |
4cb6a3dc-8c8e-44b7-b6a7-d8bc7958ffb6 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... |
ab2165cc-a7be-46fb-a3a7-21350cde3321 | 2 | private void setSimulation(boolean simulating) {
if (simulating) {
simulation.launchSimulation(getSelectedAccessPoint(), model, panel.getWidth(), panel.getHeight());
} else {
simulation.clear();
}
panel.updateSimulationDisplay(simulation);
panel.repaint();... |
181e9feb-047a-429c-886f-2f94afa12a94 | 1 | public void addSubProcess(SubProcess subProcess) {
if (!this.subProcesses.contains(subProcess)) {
this.subProcesses.add(subProcess);
reSortSubProcesses();
}
} |
2a4378e6-befe-42c6-85a2-295bd91cfa17 | 0 | public Set<Point> getPointSet(int i){
return getCell(i).getPointSet();
} |
8d81af82-c64d-427d-b5d4-560affdd7ae2 | 3 | private void answerFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_answerFieldKeyPressed
if(evt.getKeyCode() == KeyEvent.VK_ENTER){
endTime = System.currentTimeMillis();
timeProblem(startTime,endTime);
evaluteProblem();
writeLog();
if(proble... |
b38ebfbe-22bc-4986-99e3-6cc37ca42f6b | 3 | public String getWolves() {
String result = "";
boolean first = true;
for (int i = 0; i < wolves.size(); i++) {
if (!first) {
if (i == wolves.size() - 1) {
result += " and ";
} else {
result += ", ";
}
}
result += get(wolves.get(i));
first = false;
}
return result;
} |
45f58247-6c83-470c-89d7-a78745f71419 | 4 | public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException {
List<Trip> tripList = new ArrayList<Trip>();
User loggedUser = UserSession.getInstance().getLoggedUser();
boolean isFriend = false;
if (loggedUser != null) {
for (User friend : user.getFriends()) {
if (friend.equals(loggedUser)... |
f5b78dbc-1e3e-433f-acd3-0db28f73b54c | 4 | public void alerter(PlayerInteractEvent ev) {
if (Settings.logging) {
writeLog("[EntityManager] "
+ ev.getPlayer().getDisplayName().toLowerCase()
+ " tried to use an "
+ ev.getItem().getType().toString().toLowerCase() + " egg");
}
if (Settings.alertz) {
for (Player p : ev.getPlayer().getServe... |
7d7fe1ba-65c6-4184-b44f-8639a3791500 | 5 | public void move(){
x += dx;
y += dy;
// Boundaries
if(x<0) x = 0;
if(x>675) x = 675;
if(y<600) y = 600;
if(y>720) y = 720;
// Animate Thrusters
anim++;
if(anim >3) anim = 0;
} |
fdd59cbf-22f2-43af-9248-7a7cd783b81e | 1 | public static CellMarkerFactory getInstance(){
if (singlenton == null){
singlenton = new CellMarkerFactory();
}
return singlenton;
} |
4676fea8-33b8-4f8c-9c7a-1ff56384a454 | 1 | @Override
public void notifyActionListeners(ActionEvent event) {
if (!mNoNotify) {
super.notifyActionListeners(event);
}
} |
2f1c503a-3322-4aee-868c-cf6101522ba1 | 6 | public void fireSessionCreated(IoSession session) {
SocketAddress serviceAddress = session.getServiceAddress();
boolean firstSession;
Set<IoSession> s = new IdentityHashSet<IoSession>();
synchronized (managedSessions) {
// Get the session set.
Set<IoSession> sess... |
6a17b12b-e361-4cf0-a118-40d89b77cc5a | 9 | public static ArrayList parseValue(String source) throws Exception {
ArrayList list = new ArrayList();
String[] lines = source.split("\n");
for (String line : lines) {
String[] typeAndValue = line.split(" ");
if(typeAndValue[0].equals("Boolean"))
list.add(Boolean.parseBoolean(typeAndValue[1]));
el... |
b70f483e-e801-4569-bce7-6c669ffd9384 | 7 | public boolean dispose(boolean cache, Dictionary referer) {
synchronized(this) {
referenceCount--;
////System.out.println("Resources.dispose() " + getPObjectReference() + " " + uniqueId + " count: " + referenceCount + " cache: " + cache);
////System.out.println("Resource... |
8e39d37f-7484-475c-b250-35baa6c7dcca | 3 | public static int binarySearch(int[] arr, int low,int high,int key){
int mid;
while(low<=high){
mid=(low+high)/2;
if(key>arr[mid])
low=mid+1;
else if(key<arr[mid])
high=mid-1;
else
return mid;
}
... |
60acfeb8-0fc0-4bfa-b4c3-207bb3191c07 | 6 | public static Tile getTile(String s){
if(s.equals(grass.id)) return Tile.grass;
else if(s.equals(rock.id)) return Tile.rock;
else if(s.equals(flowers.id)) return Tile.flowers;
else if(s.equals(floor_wooden.id)) return Tile.floor_wooden;
else if(s.equals(door_closed.id)) return Tile.door_closed;
else if(s.eq... |
410b9a18-5340-4a1c-9a12-dd8a8d99b478 | 3 | protected boolean isFinished() {
return (shooter.bottomSwitch.get() || shooter.left.getD() <= 5 || shooter.right.getD() <= 5 || feeder.isIn);
} |
75dca141-0881-4d99-bfac-cc132ad592a1 | 2 | public Player insert(String pseudo, String password) {
try {
PreparedStatement statement = base
.prepareStatement("INSERT INTO player (pseudo, password ,meilleur_score) VALUES (?, ?, ?)");
statement.setString(1, pseudo);
statement.setString(2, password);
statement.setInt(3, 0);
statement.exe... |
7fa460f6-133e-4246-8823-6b35c2d8ec2f | 2 | @Override
public void run() {
super.run();
try {
serverSocket=new ServerSocket(Constantes.TCPSystem);
while(true){
server.console("Attente de connexion ... Tcp Controleur ok");
Socket s = serverSocket.accept();
ServerTCPMultiThreadControleur th = new ServerTCPMultiThreadControleur(s, server);
... |
d815d154-5faf-4d29-9ef8-d90fce5992b3 | 6 | @Override
public void run(CommandSender sender, String maincmd, String[] args)
{
if (sender instanceof Player && !sender.hasPermission("mobmanager.pspawn"))
{
sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to use /mm spawn");
return;
}
if (!super.validArgs(sender, maincmd, args))... |
86e26fbd-a8f6-4c63-93d4-a2babac9eb2a | 9 | public static boolean partition(ArrayList<Integer> list){
int w = 0;
for (int i = 0; i < list.size(); i++) {
w = w + list.get(i);
}
if(w % 2 == 1) return false;
int[][] matrix = new int[list.size()][w];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < w/2; j++) {
if( j == ... |
d0190c9d-5245-42d7-9887-43c11f433032 | 9 | public String getStatName(int i){
String name = null;
switch(i){
case 0: name = "int";
break;
case 1: name = "str";
break;
case 2: name = "wis";
break;
case 3: name = "vit";
break;
case 4: name = "pDef";
break;
case 5: name = "mDef";
break;
case 6: name = "fireRes";
break;
case 7: n... |
4156d401-ab63-45cc-bf22-390e4ec11062 | 9 | public XbpadFrame(final XbpadLogic logic, final Image image) {
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter(){
@Override
public void windowClosing(WindowEvent windowEvent) {
setExtendedState(Frame.ICONIFIED);
}
});
if... |
9f3f9813-6d78-443c-9fc3-b1d0152724d5 | 0 | public KomputerPC(FabrykaPodzespolowKomputerowych f){
fabrykaPodzespolowKomputerowych = f;
skladanie();
} |
e8643762-37c8-456b-bcda-82ce49fa35e4 | 2 | public String arrayToString(String[] stringToChange, String withWhat) {
// take each part of the array and separate it with ':'s
String stringToReturn = stringToChange[0];
try {
// start with the first index on the array
for (int i = 1; i < stringToChange.length; i++) {
stringToReturn = stringToReturn.c... |
91a403d7-fe27-425e-8de5-cfe2d7428198 | 2 | public NoteColor(int note) throws IllegalArgumentException {
if (note < 0) {
throw new IllegalArgumentException("The note value is lower than 0");
}
if (note > 24) {
throw new IllegalArgumentException("The note value is higher than 24");
}
this.note = note;
} |
cbfa5211-5fa6-495a-b1f3-f563cbb23224 | 7 | public void diffuse(int val, int cx,int cy)
{// centerX,centerY
//Diffusal slope is always one
if (val==0) return;
boolean negative=(val<0);
if (negative)
val=-val;
int endX=Util.lowest(cx+val,Square.xAmt());
... |
6f43c387-8cf6-4eb7-8ecf-23c24a10eb89 | 3 | public static void Recuperer_liste_clients()
{
SAXBuilder sxb = new SAXBuilder();
try {
document = sxb.build(new File("bdd_e_resto.xml"));
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.print... |
d09c7f25-6217-4aa1-96cb-4a5d2ebde252 | 2 | *
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public CycAssertion getAssertionById(Integer id)
throws UnknownHostException, IOEx... |
5a2c08b7-1a23-41c4-affd-477f2e7bb5ec | 5 | private static void checkOptions() {
if (!BloatBenchmark.INTRA && !BloatBenchmark.SPECIALIZE
&& !BloatBenchmark.INLINE) {
BloatBenchmark.err.println("** There is nothing to do!");
BloatBenchmark.usage();
} else if ((BloatBenchmark.MORPH != -1) && !BloatBenchmark.SPECIALIZE) {
BloatBenchmark.err
.... |
5d3d8c21-eb96-4250-9fa1-90280720007f | 1 | @Override
public void addAccount(User user, Account account) {
PreparedStatement pStmt = null;
try {
pStmt = conn.prepareStatement("INSERT INTO ACCOUNT (user_login, funds) VALUES (?, ?);");
pStmt.setString(1, user.getLogin());
pStmt.setDouble(2, account.getFunds());
pStmt.executeUpdate();
... |
0ad96450-01f1-44bf-a45f-fa226b7f119d | 7 | private static void test2_5() throws FileNotFoundException {
String test1 = "new game\n"+"examine\n"+"quit\n"+"no\n"+"quit\n"+"yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(test1.getBytes());
System.setIn(in);
o... |
607661ff-d002-48c1-a33d-23b71a18e81f | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
adcda694-5e7f-48b7-a2d5-a641b858e831 | 9 | public void setOverlayPainter(Painter<? super JXMapViewer> overlay) {
Painter<? super JXMapViewer> old = getOverlayPainter();
this.overlay = overlay;
PropertyChangeListener listener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent... |
d519d64f-2bbe-4ae2-90fc-c674990d6d85 | 8 | private static void parseByEventReader(InputStream inputStream, XMLInputFactory xis) {
XMLEventReader eventReader = null;
try {
eventReader = xis.createXMLEventReader(inputStream);
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
// event.getEventType()
if (event.isStartEl... |
3bbfbd71-be89-4265-873e-0ecc786a8ffe | 6 | public static void main(String[] args) throws IOException {
String inputFileName = "lua/testOutput.csv";
BufferedReader in = new BufferedReader(new FileReader(inputFileName));
CourseMapTransform mapTransform = new CourseMapTransform();
CourseMapWriter mapWriter = new CourseMapWriter(1);
String line =... |
6fcbf4cc-f0cd-4c1b-9790-a89e0982e642 | 1 | public List<Propiedad> ObtenerPropiedad(String consulta){
List<Propiedad> lista=new ArrayList<Propiedad>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
a0b22a54-0f24-4a63-b36c-ee455c2afd2f | 5 | public final void checkTakeDamage(final int damage) {
numSequentialDamage++;
lastDamageTakenTime = System.currentTimeMillis();
// System.out.println("tb" + timeBetweenDamage);
// System.out.println("ns" + numSequentialDamage);
// System.out.println(timeBetweenDamage / 1500 + "(" + timeBetweenDamage / numSequentia... |
2e7a5f7a-ac48-4faa-ac00-ab391234b5ec | 7 | private void lireConfig() throws Exception
{
String ligne ="";
boolean fini = false;
File config = new File("FichierServeur/config.txt");
try
{
BufferedReader reader = new BufferedReader(new FileReader(config));
while(!fini)
{
... |
881e0195-34a4-469e-984b-ab961205a083 | 4 | public void loadProfilesProperties() {
Logger.getLogger(Profiles.class.getName()).entering(Profiles.class.getName(), "loadProfilesProperties");
String value = PropertiesManager.getInstance().getKey("profiles");
if (value == null) {
return;
}
String[] unparsedProfiles ... |
7d8c8e28-3cd4-47f9-be9e-ebd6547d1688 | 0 | @Test
public void createMoveFromStringTest2() {
Move move = new Move("C 3");
assertEquals("C 3", move.toString());
} |
4c0ccd05-87ae-4f18-af1c-783892773033 | 8 | public void scanArchives(URL... urls) throws IOException
{
for (URL url : urls)
{
Filter filter = new Filter()
{
public boolean accepts(String filename)
{
if (filename.endsWith(".class"))
{
if (filename.startsWith("... |
3b3c82e9-d6cb-44e0-be69-222174fd7b6c | 1 | private boolean isAlmostFull() {
if (personArray.length - queueSize < 2) {
return true;
}
else {
return false;
}
} |
3951559c-e3bc-4735-80a1-be45addd7034 | 6 | public void displayCircuit() {
/*
for (int i=0; i<elements.size(); i++) {
System.out.println("El "+i+": isConnected="+elements.get(i).isConnected()+" isTurnedOn="+elements.get(i).isTurnedOn());
if (elements.get(i) instanceof InputAction) {System.out.println("Input: "+((InputAction)element... |
e2c7932a-1b9c-4fd5-a712-cea6209e6307 | 5 | public static void main(String[] args) throws Exception {
String graphName = args[0];
int nShards = Integer.parseInt(args[1]);
CircleOfTrustSalsa csalsa = new CircleOfTrustSalsa(new VertexQuery(graphName, nShards), 10000);
VertexIdTranslate vertexTrans = VertexIdTranslate.fromFile(new... |
f90c112c-b1c0-481f-b202-120a2a8f78ef | 6 | public static void main(String[] args) {
int maxFields = 16; // number of tiles (x & y)
int tileSize = 24; // size per tile
int miniscale = 4; // scaling of minimap (0 = no minimap)
boolean grid = true; // show grid overlay
boolean debug = false; // console output
long startTime = System.currentTimeMilli... |
41efdef3-807a-4156-a1a3-aeaffcd8d730 | 0 | public void setLname(String lname) {
this.lname = lname;
} |
dbd7bf5a-781b-4b0b-9622-90e77579d306 | 3 | public HashMap cashInput(int amount) throws Exception
{
char[] params = Convert.toCharArray(amount);
ArrayList<Integer> answer = this.device.send(0x50, 5, params);
if (answer.size() == 0)
throw new Exception("Пустой ответ");
HashMap<String, Integer> result = new HashMap... |
7a5b0b0f-86b9-4c08-a290-8162175203dd | 6 | public boolean containedIn(RPChromosomeRegion testRegion) {
if (startChromID > testRegion.startChromID ||
(startChromID == testRegion.startChromID && startBase >= testRegion.startBase)) {
if (endChromID < testRegion.endChromID ||
(endChromID == testRegion.endChro... |
1e16e441-6813-4956-8242-e72b81f9cbcf | 3 | public List<String> buildPropsFromList(Map<String, String> props){
List<String> notFound = new LinkedList<String>();
for(String key : props.keySet()){
Class<? extends Property> propType = PropertyFactory.getPropByType( props.get(key));
if(propType != null)
this.addProperty(key, props.get(key));
else
... |
cddd88a4-d3b8-41e9-8084-bb9908c8e2ac | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JSONObject other = (JSONObject) obj;
if (map == null) {
if (other.map != null)
return false;
} else if (!map.equals(other.map))
retur... |
02dc91e2-652f-4958-8c09-7b3b9f7b62dc | 6 | @Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
return;
}
try {
ProcessBuilder processBuilder = new ProcessBuilder(getCommandPath("psql"), "--version");
final Process process = processBuilder.start();
... |
9edb216d-63a8-4744-a1ea-002a43b88b37 | 4 | public boolean isYourMove() throws InterruptedException {
if (m_test){
System.out.println("AIEasy.isYourMove- begin");
}
setYourTurn(true);
if (!(getGame().getPlayer1() instanceof Human ||
getGame().getPlayer2() instanceof Human)){
sendMo... |
67e48442-13aa-4c93-98d9-e74d81c49308 | 2 | @Override
public void onSignOut()
{
ServerUser u = currentClient.attachment();
currentClient.close();
if (u != null)
{
System.out.println( "SERVER: sign-out: " + u.name );
userMap.remove( u.name );
for (ServerUser otherUser : userMap.values(... |
78dbb5d2-572b-42ca-8d49-3a853d2d22d4 | 1 | @Override
protected void setReaction(Message message) {
for(String s : content)
sendMessage(message.author, s);
} |
ed404444-dd4c-4570-8f6d-4fd573b81f3c | 9 | @Override
protected Set<NucleotideInteraction> parseInteractions(
Map<String, Sequence> aSequenceMap, File anOutputFile)
throws IOException {
// check that the sequence map is not empty
if (aSequenceMap.isEmpty()) {
throw new IOException("Empty sequence map! Nothing to do!");
}
Set<NucleotideInteracti... |
6207aceb-d8a2-4c2d-9827-a069d9bde77a | 1 | public void visit_iflt(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_ifge);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_iflt);
addBranch((Label) inst.... |
25e228ec-2d2e-47c2-8ed6-283eaa180c7b | 2 | @Override
public void render(Graphics2D g2d) {
bg.render(g2d);
g2d.setColor(new Color(128, 0, 0));
g2d.setFont(new Font(Fonts.CLEOPATRA, Font.PLAIN, 36));
Gfx.drawString(g2d, Game.TITLE, 70);
for(int i = 0; i < options.length; i++){
if(i == currentChoice)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.