method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
73b1bd9a-079c-4b21-ae4b-5bc17d4918c4 | 8 | private boolean computeCell(int col, int row)
{
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(col, row);
// we will return this... |
6d16c1c6-e971-4707-90b0-0daf1d2e1f12 | 7 | private void init(int belt, int sz, Coord off, int key) {
gsz = new Coord(1, sz);
this.off = off;
fbtn.show();
mrgn = new Coord(2, 18);
layout = new Slot[sz];
loadOpts();
cbtn.visible = false;
lockbtn = new IButton(Coord.z, this, locked ? ilockc : ilocko,
... |
0a9e076c-42b2-4c0c-b1d8-27b687ac1a7d | 0 | public Distance nextDistance() {
_setDistance(_currIndex+1);
return _distances[_currIndex];
} |
3174a2fa-d79b-4dce-a7d3-190c0060b75f | 9 | public ArrayList<String> instSequence(ArrayList<Integer> globalSeen)
{
ArrayList<PLIRInstruction> orderedInsts = new ArrayList<PLIRInstruction>();
for (PLIRInstruction inst : instructions)
{
if (orderedInsts.size() == 0) orderedInsts.add(inst);
else
{
boolean added = false;
for (int i = 0; !adde... |
0946058b-087e-41da-b4e8-2a840419f78f | 2 | private void setSelection(Entity e) {
// clear the previous selection owner
if (m_currentFocusOwner != null && m_currentFocusOwner != e)
m_currentFocusOwner.selected = false;
// set the new selction owner
m_currentFocusOwner = e;
} |
8170ffb9-646a-4c25-9426-2419ac7c5a69 | 3 | public void writeInt(long v)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeInt = " + v);
}
if ((-2147483648L < v) && (v < 2147483648L)) {
writeFixnum((int) v);
}
else {
writeBignum(v);
}
} |
9a13fee2-7f46-422b-91ca-17dc84d97b09 | 5 | public static void displayMenu(ArrayList<Student> StudentList) throws FileNotFoundException {
int menuChoice = 0;
ArrayList<Student> inList = new ArrayList<Student>();
inList = StudentList;
do{
System.out.println("Main Menu");
System.out.println("---------");
System.out.println("What would you l... |
ed14652d-f4ef-48e0-b9b9-e61d8def29f8 | 4 | @Override
public boolean isValid()
{
boolean retVal = true;
retVal = retVal && (this.stdoutLen >= 0) && this.stdoutData.length == this.stdoutLen;
retVal = retVal && (this.stderrLen >= 0) && this.stdoutErr.length == this.stderrLen;
return retVal;
} |
0e6fb120-9068-49fe-a515-0914d6389562 | 9 | public boolean estSelectionne(int leX, int leYy) {
double a, b, c, h, g;
int x1 = (int) getExtremiteInitiale().getCoordonnees().getX();// this.debut.getX();
int y1 = (int) getExtremiteInitiale().getCoordonnees().getY();// this.debut.getY();
int x2 = (int) getExtremiteTerminale().getCoordonnees().getX();// this.... |
58e42419-2777-4d86-bb04-30367f5158e0 | 3 | public void filterTextChanged(){
super.filterTextChanged();
String filterText = filterTextField.getText();
//if(filterText.equals("")){
// stopFiltering();
//tree.refresh(tree.rootItem.editorData, true);
//}
if(isFilterin... |
e5f0b424-fed5-4600-a60e-e1dcc7ae97b7 | 6 | @Override
public Dimension getPrefferedSize(WidgetContainer container) {
synchronized (container.getRootLock()) {
Iterator<Widget> iter = container.getChildren().iterator();
final Inset inset = container.getInset();
int componentWidth = 0;
int componentHeight ... |
f93e32b7-d647-46e5-9bc3-9a8ad4f0479d | 7 | static public String SysInfoIsAlreadyConfigured() throws FileNotFoundException, IOException, NamingException, SQLException {
if (props == null) {
props = Basics.getConfiguration();
}
String line = "0";
String out = "";
Context ctx = new InitialContext();
Data... |
7dd4ff24-1d47-4f69-bf8e-25874c6725ac | 8 | private void animate() {
graphics.clearRect(0, 0, canvasWidth, canvasHeight);
drawLabel.repaint();
// first, calculate the total length of line segments and turns,
// in order to allocate drawtime proportionally later
double totalLength = 0;
for ... |
0b48070b-e380-4c8d-be12-821a36a2bdf9 | 5 | public void removeHunter(final AID hunterAID) {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "removeHunter()");
if (hunterAID != null) {
Hunter hunter = new Hunter(hunterAID);
if (this.hunters.contains(hunter)) {
for (Hunter h : hunters) {
if (h.equals(hunter)) {
worldMap[h.ge... |
f9ecef7f-1b9b-4a84-a921-0b297da2db29 | 1 | public static JSONObject getJsonObjectFromIntegerMap(Map<String, Integer> messageMap) {
JSONObject jsonObj = new JSONObject();
for (Map.Entry<String, Integer> entry: messageMap.entrySet()) {
jsonObj.put(entry.getKey().toString(), new JSONNumber(entry.getValue()));
}
return jsonObj;
} |
063b1006-73fa-43c7-a6f1-ad14b1f54a4c | 6 | public void play() {
if (!MUSIC_ON && (name.equals("music1") || name.equals("music2")))
return;
if (!SOUND_ON && !name.equals("music1") && !name.equals("music2"))
return;
new Thread() {
public void run() {
clip.play();
}
}.start();
} |
b2a822af-9c61-4cba-9302-357b41598c62 | 2 | public List<GameSpawns> getTeamCoords(ChatColor color) {
List<GameSpawns> teams = new ArrayList<GameSpawns>();
for (GameSpawns team : this.spawnCoords) {
if (team.getColor() == color) {
teams.add(team);
}
}
return teams;
} |
a01c1c42-1ad8-48f7-ac32-312e94b85101 | 7 | @Override
public NewId parse(String text) {
if (text == null || text.isEmpty())
throw new IllegalArgumentException("The String was null or empty");
char[] buffer = new char[32];
int bufferOffset = 0;
int offset = 0;
long number;
for (int i = 0; i < 6; ++i) {
number = 0;
for (int j = 0; j < 4; j+... |
7a462427-c524-4f81-aa5f-9f7e203b787e | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Cadastra o usuário
String nome = jTextField1.getText();
String email = jTextField2.getText();
String senha = String.copyValueOf(jPasswordField1.... |
2a7578c5-2cee-45b4-997a-84dfd9470253 | 1 | @Override
public BlockingQueue<Quote> registerProvider(Symbol symbol) throws ProviderAlreadyRegisteredException {
if (providers.containsKey(symbol)) {
throw new ProviderAlreadyRegisteredException();
}
BlockingQueue<Quote> quotes = new LinkedBlockingQueue<Quote>();
provide... |
33f67967-e896-493a-8c47-c24fe466c4dc | 3 | public void doBackLog(){
while (backLog.size()>0 && this.stock > 0){
Customer c= this.backLog.removeFirst();
if (this.stock < c.getJumMobil()){
this.deStock(this.stock);
c.setJumMobil(c.getJumMobil()-this.stock);
this.backLog.addFirst(c);
... |
95026460-9c1e-4d80-8a7a-fbfe8324b970 | 4 | @Override
public float isContextMenuEnabledAt( int x, int y ) {
if( connection.getOpenConnectionPath().intersects( x, y, 1, 1 )){
return 1;
}
if( connection.getOpenConnectionPath().intersects( x-1, y-1, 3, 3 )){
return 0.5f;
}
if( connection.getOpenConnectionPath().intersects( x-2, y-2, 5, 5 )){
r... |
4fc5c668-f30b-4905-875f-5705d07e58c8 | 5 | public void mixWt_read(String path) throws IOException {
FileInputStream is = null;
DataInputStream dis = null;
try{
is = new FileInputStream(path);
dis = new DataInputStream(new BufferedInputStream(is));
senones = (int)dis.readFloat();
gaussian = (int)dis.readFloat();
mixWt = new float[senones][ga... |
66da9358-c795-411d-a0db-f00ffb500a7c | 5 | public ProductList getProductList(String prod_desc)
{
if(prod_desc.isEmpty())
{
letter = true;
return null;
}
else
{
max_index = prod_desc.length(); // Check number of symbols
prod_id_num = 0;
if((prod_desc.cha... |
03522eb6-4721-4b3d-b0f2-85da56d13a23 | 0 | public TreeModel getModel() {
return tree;
} |
4f4367a0-483a-4a29-8dbf-8348f87cb607 | 5 | public static void promote(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
Node parent = currentNode.getParent();
if (parent.isRoot()) {
return;
}
// Put the Undoable onto the UndoQueue
Node targetNode = parent.getParent();
int targetIndex = parent.currentIndex() + 1;
CompoundUndo... |
bbfc4c32-d400-4d1b-b965-c6fe17b7af12 | 4 | public void putBeeper() {
if (Display.isDead())
return;
if (beepers < 1 && beepers != Display.INFINITY) {
Display.die("Trying to put non-existent beepers!");
return;
}
if (beepers != Display.INFINITY)
beepers--;
WorldBackend.getCurrent().putBeepers(x, y, 1);
Display.step();
} |
48a37516-9ef1-4bc4-8bcd-70968489e33b | 7 | static private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
cas... |
181299b7-26b4-4978-b980-aa5944c7f5ca | 4 | public static String longToPlayerName(long l) {
if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) {
return null;
}
if (l % 37L == 0L) {
return null;
}
int i = 0;
char ac[] = new char[12];
while (l != 0L) {
long l1 = l;
l /= 37L;
ac[11 - i++] = VALID_CHARS[(int) (l1 - l * 37L)];
}
return new Stri... |
202db2c6-9571-404c-a5a7-14193fc961f2 | 5 | private void cmdFEATURES(final ArrayList<String> args) {
if (status == HANDSHAKE_PENDING_2) {
if (args.size() >= 0) {
serverFeatures = new ArrayList<String>();
for (String a : args) {
for (String b : clientFeatures) {
if (a.equals(b)) {
serverFeatures.add(a);
}
}
}
send... |
0f11c2e9-431f-44ab-82fd-ffaa7f9c39c2 | 1 | public ResultFrame(boolean matched, String resultString) {
this.setTitle("Analysis Results");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setSize(Main.WIDTH/2, Main.HEIGHT - 100);
this.setResizable(false);
this.setLocationRelativeTo(null); //center window on screen
resultPa... |
98cb8ab8-3da8-45e7-8bb3-2cd9f7587604 | 3 | public GameTreeNode bestMove(){
ArrayList<GameTreeNode> good = new ArrayList<GameTreeNode>();
for (GameTreeNode n : children){
if (n.getValue() == -1) good.add(n);
}
if (good.size()>0) return good.get(good.size()-1);
int next = (int)(Math.random()*children.size());
ret... |
003e0738-ea26-41a3-8719-ec62be269c70 | 0 | @PersistenceContext
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
} |
36edfc4c-6747-43f2-8847-72e6fa2e1884 | 0 | public int size()
{
return accounts.length;
} |
6d1016e2-b5fc-411a-a510-d831e32744a2 | 0 | public String getKeyName() {
return this.value;
} |
6d192a63-b0ae-4589-8753-6564b58d7084 | 8 | public static void main(String[] args) {
FileReader fr = null;
String Folder=Long.toString(System.nanoTime());
try {
File A=new File("json.txt");
fr = new FileReader (A);
BufferedReader br = new BufferedReader(fr);
String linea;
ArrayList<String> ListaFiles=new ArrayList<String>();;
while ((lin... |
24c020f4-255d-4114-b57f-336a773e6902 | 8 | public void clear() {
for (int i = 0; i < modes; i++) {
mode_param[i] = null;
}
mode_param = null;
for (int i = 0; i < maps; i++) { // unpack does the range checking
FuncMapping.mapping_P[map_type[i]].free_info(map_param[i]);
}
map_param = null;
... |
19463a67-8919-473a-b63b-0aa9ecc85b50 | 7 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
if(event.getAction()==Action.LEFT_CLICK_BLOCK && event.getPlayer().getItemInHand().getType() == Material.FIRE){
try{
plugin.l1 = event.getClickedBlock().getLocation();
plugin.m.sendMessage(player, "... |
283110c9-0c2b-4521-873e-5736926ef6bf | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DataProvider other = (DataProvider) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(o... |
1fd6a351-4e80-4a9f-bc49-bc9e6cd605b1 | 4 | void finishGame()
{
System.out.println("1. Continue game.");
System.out.println("2. Finish game.");
try
{
int decision = sc.nextInt();
switch(decision)
{
case 1:
continued = true;
game();
... |
47c5de81-ddb4-45c4-8247-28530154fa10 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Empleado)) {
return false;
}
Empleado other = (Empleado) object;
if ((this.empNoEmpleado == null && other.empNo... |
56edfde4-9424-41b5-abdb-4ec60b6defc3 | 5 | private void drawPauseScreen(Graphics2D g){
g.setColor(Color.WHITE);
g.drawString("PAUSED", (getWidth()-fm.stringWidth("PAUSED"))/2, 100);
if (pauseTextAreas[0].contains(MouseInfo.getPointerInfo().getLocation()))
g.setColor(Color.RED);
else
g.setColor(Color.WHITE);
g.drawString("Continue", (getWi... |
a177ec5d-dfef-4a76-9408-40dc71d9ddf8 | 4 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String integersString = scanner.nextLine();
String[] numbers = integersString.split(" ");
ArrayList<String> increasingSequence = new ArrayList<String>();
ArrayList<String> currentSequence = new ArrayList<String>();
i... |
e713e959-7a63-46d4-9c04-acca277acfa0 | 0 | public int getBumonCode() {
return getValue().getBumoncode();
} |
e58eeebe-6255-4029-be18-f8cc30b21286 | 5 | private void addMentorBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMentorBtnActionPerformed
studentListTA.setText("");
try {
//Collecting mentor attributes
String mentorFN = mentorFNTxt.getText();
String mentorLN = mentorLNTxt.get... |
d76f4c1a-b0ed-4134-9ead-55c0e31933cb | 4 | public static void main(String[] args) {
Tablero obj=new Tablero();
Scanner lea = new Scanner(System.in);
int opc, salir=0;
do {
System.out.println("Menu Principal");
System.out.println("1. Jugar Ajedrez");
System.out.println("2. Estadisticas de Juegos... |
0c8d5ed8-9521-46d7-83ce-c32ae6eb8d7d | 0 | public void setNumOfTabs(int numOfTabs) {this.numOfTabs = numOfTabs;} |
ad7acf51-10d4-406c-9fc4-6c75d0d2c258 | 3 | public int getPlayerIndexOfSquare(int row, int col) throws Exception {
String playerSymbol = this.square[row][col];
if( playerSymbol.equals(X) ) {
return PLAYER_X;
} else if ( playerSymbol.equals(O) ) {
return PLAYER_O;
} else if ( playerSymbol.equals(BLANK) ) {
return PLAYER_NONE;
} else {
throw ... |
5f4ff714-16b7-427f-93ab-2088aa248ae8 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof OFFlowStatisticsRequest)) {
return false;
}
OFFlowStatisticsRequest other = (OFFlowStati... |
4ccf051e-3920-4e67-9518-8507f807da41 | 1 | public Deck(Player[] players, int rackSize){
//Official rules are 2-4 players and rack_size == 10
//However, we'll relax these restrictions...
assert(players.length > 1 && rackSize > 1);
this.rack_size = rackSize;
this.players = players;
cards = rackSize*players.length + rackSize*2;
//Initialize deck; ... |
cc3b92d0-b21a-4adf-af8e-8a2bf0489395 | 1 | public E max() {
if (max == null) {
findMax();
}
return max.getValue();
} |
c75548ac-9d75-41ac-a323-f4b8b01a5f14 | 5 | @Override
public Handshakedata translateHandshake( ByteBuffer buf ) throws InvalidHandshakeException {
HandshakeBuilder bui = translateHandshakeHttp( buf, role );
// the first drafts are lacking a protocol number which makes them difficult to distinguish. Sec-WebSocket-Key1 is typical for draft76
if( ( bui.hasF... |
1c00cc81-5f69-4bf1-8f9c-8067f00b5e5e | 1 | public void testWrongPassWord(){
Client c =Client.getInstance();
try {
c.connect(url,userName,"wrong");
fail();
} catch (XmlRpcException e) {
log.error(e.getMessage());
}
} |
36e4d143-bf4f-4474-93b8-106123681976 | 3 | public void visitForceChildren(final TreeVisitor visitor) {
final LinkedList list = new LinkedList(stmts);
if (visitor.reverse()) {
final ListIterator iter = list.listIterator(stmts.size());
while (iter.hasPrevious()) {
final Stmt s = (Stmt) iter.previous();
s.visit(visitor);
}
} else {
fina... |
b2250e1a-590d-45a7-afd3-ff0b95a56432 | 0 | public String read(String name) {
return cookies.get(name);
} |
062afdce-597a-402f-b1d1-8d27c7e58baf | 1 | @Test
public void testFeistel() {
byte[] subKey1 = ByteHelper.convertBinaryStringToByteArray("000110 110000 001011 101111 111111 000111 000001 110010");
byte[] blockR0 = ByteHelper.convertBinaryStringToByteArray("11110000 10101010 11110000 10101010");
byte[] expectedResult = ByteHelper.con... |
68000d71-7370-4d0c-8ba2-6cd7b0942086 | 1 | @Override
public void addServerExceptionListener(IExceptionListener listener) throws Exception {
if (serverExceptionListenerList != null) {
serverExceptionListenerList.add(IExceptionListener.class, listener);
}
} |
e489e59d-9e11-4282-9c08-52e4d9df0231 | 6 | public Text read() throws Exception{
readFromFile();
ArrayList<PartOfText> partsOfText = new ArrayList<PartOfText>();
if(null != text){
Pattern p = Pattern.compile("([^.?!]+[.?!])|(\\n.*\\{(\\n.*\\n)*\\}\\n)|(.+)");
Matcher m = p.matcher(text);
String str;
... |
81e98dc2-b56f-440a-8c42-e34494867eda | 0 | public static void main(String[] args) throws Exception {
Thread d = new Thread(new Daemon());
d.setDaemon(true);
d.start();
System.out.println("d.isDaemon() = " + d.isDaemon() + ", ");
TimeUnit.SECONDS.sleep(1);
} |
b417106a-0951-4933-8f61-8b47ff8df10f | 5 | static final void method1260(boolean bool, int i, Class190 class190) {
if (Class348_Sub40_Sub10.aBoolean9181) {
Class348_Sub40_Sub10.aBoolean9181 = false;
i = 0;
}
anInt2140++;
if (Class239_Sub14.aClass190_5990 == null
|| !Class239_Sub14.aClass190_5990.method1424(class190,
(byte) 84)) {
... |
943a7bbc-b259-4e3c-b175-c660620e8b98 | 9 | public void storeForecast(ForecastData forecast) {
if (forecast.zip.equalsIgnoreCase("denver,co")) forecast.zip="80201";
String prefix = forecast.zip + "," + timeFormat.format(forecast.date)
+ "," + forecast.today + "," + forecast.forecastDate;
if (forecast.overallForecast.high != null
|| forecast.overall... |
62403992-e782-4b39-8879-54cc7f52ca35 | 3 | public void paivitaRaajojenKoordinaatit(){
for (int i=0; i<4; i++){
for (double[][] taulu : koordinaatit){
taulu[i][0]=taulu[i][2];
taulu[i][1]=taulu[i][3];
}
}
Raaja raaja1;
Raaja raaja2;
for (int j=0; j<4; j++){
... |
8ca0c455-6847-4745-abec-6181cbe3ef54 | 9 | private static PDFDecrypter createStandardDecrypter(
PDFObject encryptDict,
PDFObject documentId,
PDFPassword password,
Integer keyLength,
boolean encryptMetadata,
StandardDecrypter.EncryptionAlgorithm encryptionAlgorithm)
throws
... |
076653f0-6b96-4b5a-85b5-9fa7e53485e7 | 8 | public Handle open (Credential cr, int mode) {
// try to open entry.
Handle hdl = super.open (cr, mode);
if (hdl.rc != Handle.RC_OK)
// open failed on basic level
return hdl;
// determine access mode
String fMode = "r";
if (hdl.forWrite) fMode = "rw";
// check access to open physical file
j... |
a8b09ad4-0629-4ef5-af0a-eda17678641d | 2 | @Override
public int compare (Henkilo h1, Henkilo h2)
{
if (h1.getSyntymavuosi() > h2.getSyntymavuosi()) return -1;
if (h2.getSyntymavuosi() < h1.getSyntymavuosi()) return 1;
return 0;
} |
ea2839b8-fb0f-4014-a579-733917804af0 | 2 | int truncatePixel(double originalValue) {
if (originalValue > MAX_VAL) {
return MAX_VAL;
} else if (originalValue < MIN_VAL) {
return MIN_VAL;
}
return (int) originalValue;
} |
c517812e-b40e-4140-8158-92063223a33e | 1 | public String retrieveAdminOrg(String orgsLink, String orgName) throws Exception{
String response = doGet(orgsLink);
String element = findElement(response, Constants.LINK, Constants.ADMIN_ORG_LINK, orgName);
if( element == null){
throw new Exception(" " + orgName);
}
return element;
} |
c2df7bd0-d1d0-41b3-9dd7-e558b528ea1a | 4 | public void singleHostFailure(String filename, Host hostToKill, Host... network) {
simulation_.killHost(hostToKill);
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
}
repair_.fixNode(hostToKill);
try {
Thread.sleep(1000);
... |
86898bc0-dfc1-42eb-a741-3dacaa2547c4 | 3 | public static void main(String[] args)
{
// Retrieve command line arguments
if (args.length < 1)
{
System.out.println("Usage: java EmployeeRetriever <EmployeeObjectName>");
return;
}
try {
// Try and retrieve the RMI object with the given object name
Registry registry = LocateRegistry.getRegistr... |
59117133-4ba0-403c-bdd9-a9e9ab3cd977 | 8 | public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getCaregiver() != null) {
_hashCode += getCaregiver().hashCode();
}
if (getGoalDesc() != null) {
_hashCode += g... |
558c7c44-b3b3-4e40-88b0-0d72fe245fa9 | 7 | public List<User> divideUsersintoFive(List<User> userList) throws ParseException {
List finalList = new ArrayList();
for (User userList1 : userList) {
User user = (User) userList1;
List firstPostList = new ArrayList();
List secondPostList = new ArrayList();
... |
92d524cb-ff67-4f63-8e26-9b4fc9df7ba6 | 3 | public String getExtension(File f) {
if(f != null) {
String filename = f.getName();
int i = filename.lastIndexOf('.');
if(i>0 && i<filename.length()-1) {
return filename.substring(i+1).toLowerCase();
};
}
return null;
} |
9c54e9ad-e375-4861-8957-fb5dd45ad975 | 4 | private void enregistrer(String s) {
EnregistrerTexte e;
if(s.equals("dcrypt")) {
e=new EnregistrerTexte(s,this.res.getMessageDecode(),this.res, this.menu,this);
}
else {
e=new EnregistrerTexte(s,this.res.getMessageCode(),this.res, this.menu,this);
}
while(e.estEnCours() && !this.stop) {
try {
... |
a252dd98-304b-4fb6-a76d-0ed144720c1a | 1 | @Override
public void addState(SubProcess subProcess, State state) {
state.setSubProcess(subProcess);
tx.begin();
if (em.contains(state)) em.merge(state);
else em.persist(state);
tx.commit();
} |
1399f83c-01ff-4c14-af2d-e7abe94e34a2 | 9 | private static boolean func_71608_a(String par0Str)
{
if (par0Str.length() < 3 || par0Str.charAt(1) != '.')
{
return false;
}
char c = par0Str.charAt(0);
if (c < '0' || c > '2')
{
return false;
}
boolean flag = false;
... |
da4ec6f6-b597-401c-b441-a133e4d0668f | 6 | @SuppressWarnings("deprecation")
public void testFactory_between_RPartial() {
LocalDate start = new LocalDate(2006, 6, 9);
LocalDate end1 = new LocalDate(2006, 6, 12);
YearMonthDay end2 = new YearMonthDay(2006, 6, 15);
Single zero = new Single(0);
assertEquals(3, Sin... |
058128c5-2643-442c-9ec9-99cd320c40b9 | 9 | public static double[] bfs(double[][] mst, int startIndex)
{
double[] dist = new double[mst.length];
if(startIndex < mst.length);
{
for(int i=0; i<dist.length; i++)
{
dist[i] = Integer.MAX_VALUE;
}
dist[startIndex] = 0;
LinkedList<Integer> q = new LinkedList<Integer>();
q.add(st... |
057d7645-3bbf-40d9-b77b-bb7d2c2878ae | 4 | public static boolean arrayContains(int e, int[] array){
if(array == null || array.length == 0)
return false;
for(int i = 0; i < array.length; i++) {
if (array[i] == e)
return true;
}
return false;
} |
f82632ce-d267-4d1e-8486-3dada6fef955 | 0 | public static Session newSession() {
String sessionId = generateSessionId();
Session rtn = new Session(sessionId);
sessions.put(sessionId, rtn);
return rtn;
} |
0babb4f0-e2cf-4865-a617-a5c2b4c5fe2d | 4 | private void watchCards(){
ArrayList<Card> cards = this.deck.getMyCards();
for(Card c : cards){
if(c instanceof EnergyCard){
this.showEnergyCard(c);
}else if(c instanceof TrainerCard){
this.showTrainerCard(c);
}else if(c instanceof PokemonCard){
this.showPokemonCard(c);
}
}
System.... |
d7af89a3-c252-43af-8150-3d4ed33e5763 | 5 | private void displayMenuStats() throws Exception {
int input;
System.out.println("Here you are in the statistics Menu :");
System.out
.println("1: Display the device which have been the most borrowed");
System.out
.println("2: Display the device which have... |
774e0d61-f473-4447-9af2-d07cbf0629c1 | 4 | public boolean setWidth(int width) {
boolean setWidth = false;
if (width>=MIN_WIDTH && width<=MAX_WIDTH) {
m_Width = width;
setWidth = true;
} else {
if (width<MIN_WIDTH) {
m_Width = MIN_WIDTH;
System.out.println("The width of the Start Screen"+
" is out of the set below the bound.");
... |
51e400da-917a-4f57-ae43-a1eed6b1bafb | 7 | private RdpPacket_Localised receiveMessage(int[] type) throws IOException,
RdesktopException, OrderException, CryptoException {
logger.debug("ISO.receiveMessage");
RdpPacket_Localised s = null;
int length, version;
next_packet: while (true) {
logger.debug("next_packet");
s = tcp_recv(null, 4);
if (... |
568499c9-6c6a-45c6-99fd-66a5778b8e0c | 7 | public Color getRosterColor() {
if ((trip == null) || (trip.getRosterCount() == 0)) {
return Color.RED;
}
int rcnt = 0;
for (Roster r : trip.getRosterList()) {
if (!r.isAvailableAt(trip.getTripDate()))
return Color.RED;
if (!r.getIsAspirant())
rcnt++;
}
if (rcnt == 0)
return Colo... |
a3fb4454-db9b-4dcb-be00-123ee6b2b1d0 | 5 | public Token getNextToken() throws Exception
{
// Skip blanks.
while (Character.isWhitespace(ch))
{
nextCharNoPrint();
}
while (ch == ';')
{
line = reader.readLine();
nextCharNoPrint();
}
// At EOF?
if (ch == 0)
{
retur... |
e4be2897-3574-4997-b65d-3d89df8d0cd9 | 7 | public String toString() {
String s, sep = "+";
for (int i = 0; i < plateau.length; i++)
sep += "---+";
s = sep + "\n";
for (int i = 0; i < plateau.length; i++) {
s += "|";
for (int j = 0; j < plateau[0].length; j++) {
if (plateau[i][j] == null)
s += " |";
else {
if (plateau[i][j]... |
7b1ecf7b-708b-4fa3-8077-e8a94610017d | 0 | @Test
public void runTestArrayAccess1() throws IOException {
InfoflowResults res = analyzeAPKFile("ArraysAndLists_ArrayAccess1.apk");
Assert.assertEquals(0, res.size());
} |
12d2d490-a844-4558-b130-a1a6c317f46c | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
ec9ddf38-17cd-4cec-834d-11737ad6a9f8 | 7 | public void resetAvailableTasks(ArrayList<Integer> indices,
ArrayList<StreamTask> tasks, Boolean isReset, Boolean isSearching) {
// error: length not the same
assert (indices.size() == tasks.size()) : StreamConstants.Assertion.SIZE_DIFFERENT;
availIndices = indices;
availTasks = tasks;
if (tasks.size() == ... |
a9c1a21b-378b-4a3c-a4b0-c4314853dc79 | 3 | public Integer[] allCardNumbersInHand() {
ArrayList<Integer> numbers = new ArrayList<Integer>();
ArrayList<Card> cards = this.hand.getList();
Integer num;
for (int i = 0; i < cards.size(); i++) {
num = cards.get(i).getCardNum();
if (!numbers.contains(num)) {
numbers.add(num);
}
}
Collections.so... |
6c82a942-1a13-43a6-b149-3830c8336cc0 | 6 | public void cargarArbol() {
int count = 0;
int aux = 1;
int entre = 0;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
parent1 = (DefaultMutableTreeNode) e.nextElement();
if (count >= aux) {
CLS_ITEM_CONTA obj... |
11a069f6-a97c-4d84-9b6c-15fcafc3e041 | 0 | public int getSize() {
return size;
} |
ac2ec55e-7b33-4fc1-8adc-34797fc4cc48 | 4 | @Override
public String toString() {
StringBuffer result = new StringBuffer();
result.append("+");
for (int i = 0; i < gv.getColSize(); i++) {
result.append("---+");
}
result.append("\n");
for (int row = (gv.getRowSize()-1); row >= 0; row--) {
result.append("... |
d8cb933f-242f-4c40-af75-b1fd1b031d19 | 9 | @Override
public ResourceBundle newBundle(String baseName, Locale locale, String format,
ClassLoader loader, boolean reload)
throws IllegalAccessException, InstantiationException, IOException
{
if ((baseName == null) || (locale == null) ||
(format == null) || (loade... |
1031e717-1d96-4e0f-b341-4d2b0d205fc9 | 8 | private void orient(int node, int numberOfNodes, int[] invertedBranching) {
// Flag this node as visited.
visited[node] = true;
// Consider arcs leaving the given node (node).
for (int to = 0; to < numberOfNodes; ++to) {
if (node == to)
// Skip auto-cycle arcs.
continue;
if (!visited[to] && inci... |
8927c596-4483-4224-ad18-d7572eb3dbd2 | 6 | public Sound(String fileName) {
// specify the sound to play
// (assuming the sound can be played by the audio system)
// from a wave File
try {
File file = new File(fileName);
if (file.exists()) {
System.out.println(file.getAbsolutePath());
AudioInputStream sound = AudioSystem.getAudio... |
5512f789-0ed6-4862-8a87-87f097a49f24 | 2 | private void comment() throws Exception {
while(next != -1 && (char)next != '\n') {
consume();
}
} |
625ee388-00ae-4c16-a9f6-45252604d72a | 7 | public int MoveInstanceToBestCluster(Instance inst) {
clusters.get(m_clusterAssignments.get(m_processed_InstanceID)).DeleteInstance(inst);
m_clusterAssignments.set(m_processed_InstanceID, -1);
double delta;
double deltamax;
int clustermax = -1;
int tempS = 0;
int tempW = 0;
if (inst in... |
14d702f3-de25-49d0-830e-e51cefca50e6 | 9 | protected static File createRelativePath(File absolute) throws Exception {
File userDir = new File(System.getProperty("user.dir"));
String userPath = userDir.getAbsolutePath() + File.separator;
String targetPath = (new File(absolute.getParent())).getPath()
+ File.separator;
... |
7fed4007-ae18-43b4-ab65-35f70457bacd | 1 | public static byte[][] StringArrayToData(String[] strings) {
byte[][] data = new byte[strings.length][];
for(int i = 0; i < strings.length; i++) {
data[i] = strings[i].getBytes();
}
return data;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.