method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4191463e-a608-4b0f-a1f0-bf788b83df06 | 4 | public boolean updateScore(int player1Score, int player2Score) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: updateScore() BEGIN");
}
getDrawing().setPlayer1Score(player1Score);
getDrawing().setPlayer2Score(player2Score);
if (test || m_test) {
... |
1b42c069-f139-4b49-b900-7d0e0e008a9a | 5 | public boolean pageSetup(PrintProxy proxy) {
if (useNativeDialogs()) {
PageFormat format = mJob.pageDialog(createPageFormat());
if (format != null) {
adjustSettingsToPageFormat(format);
proxy.adjustToPageSetupChanges();
return true;
}
} else {
PageSetupPanel panel = new PageSetupPanel(getPri... |
e1ec3913-f213-4918-b2d6-7cdb68a63fe4 | 9 | public Object[] exec(ImagePlus imp1, String new_name, boolean whiteParticles, boolean connect4) {
// 0 - Check validity of parameters
if (null == imp1) return null;
int width = imp1.getWidth();
int height = imp1.getHeight();
int size = width * height;
ImageProcessor ip3;
ImagePlus imp3;
int x, y, ... |
aff20682-c16f-4598-9c3b-8ed938e7dd01 | 4 | void Louer() {
// Début de la location
int idCarte = Integer.parseInt(JOptionPane.showInputDialog("Numéro carte abonnée ?"));
Utilisateur user = null;
for (Utilisateur s : ConfigGlobale.utilisateurs) {
if(s.getFk_id_carte()==idCarte){
user = s;
... |
e481079c-0be6-435f-aa72-e88a081d7bd1 | 4 | public void randomStart()
{
start = rand.nextInt(2);
switch(start)
{
case 0: direction = 6;
break;
case 1: direction = 5;
break;
case 2: direction = 5;
break;
case 3: direction = 6;
break;
}
} |
3ef655a3-8158-4bd3-bc3c-00b17540686b | 0 | public int getQuantityOfHurdles() {
return hurdleList.size();
} |
c10389a0-d23c-48f9-95ce-f95b956502a6 | 9 | public void handlePacket(int id, PacketReader read, ClientConnection client) {
try {
if (id == 2) {
int sub = read.readInt();
if(sub == 0){
}else if(sub == 1){
RaspIDE.newSnippet(read.readString());
}else if(sub == 2){
String name = read.readString();
RaspIDE.getSnippet(name).s... |
a01c9c72-cd36-404e-b987-5984addaccae | 9 | protected List<PingData> read(InputStream in) {
List<PingData> retval=null;
try {
while(true) {
try {
String name_str=Util.readToken(in);
String uuid_str=Util.readToken(in);
String addr_str=Util.readToken(in);
... |
91403e55-2e07-4d56-9372-7ec8bde70791 | 5 | public void insertBelow(String filter) {
gui.addToHistory(filter);
if (filter != null && !filter.trim().equals("")) {
JList list =
(JList) filterLists.elementAt(currentFilterIndex);
int i = list.getSelectedIndex();
DefaultListModel model =
... |
e85917e6-71c7-425f-8c0b-3b0e2ef62592 | 6 | public void checkAttackCollision(Character c){
Ellipse2D.Double attackArea = null;
if(c.getDirection() == "up"){
attackArea = new Ellipse2D.Double(
c.getX(),
c.getY() - c.getWidth()/2,
c.getWidth(),
c.getHeight());
}else if(c.getDirection() == "down"){
attackArea = new Ellipse2D.Doubl... |
b9c1ee17-6ec2-4db6-accb-c25247d9f1f2 | 6 | public void close(){
System.out.println("inner close");
if(is != null){
try {
is.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
is = null;
}
if(os != null){
try {
os.flush();
os.close();
} catch (IOException e) {
// TODO ... |
1574cdff-2dc9-481a-8ee9-e05e0f946343 | 1 | public String toString()
{
if (nome != null)
return nome.toString();
return id + "";
} |
9be63dd4-8c09-48d5-8f26-259e92b4a668 | 7 | public void changeGameState() {
if (this.isGameEndConditionReached()) {
if (this.gameState == Game.GAME_STATE_BLACK) {
this.gameState = Game.GAME_STATE_END_BLACK_WON;
} else if (this.gameState == Game.GAME_STATE_WHITE) {
this.gameState = Game.GAME_STATE_EN... |
74cd66d5-c782-4199-a393-1f26e3451eb9 | 6 | @Override
public void performOperation(String name, ArgParser args) {
//We support only three args, add, remove, and list
loadProperties();
if (args.hasOption("-add")) {
String prop = args.getStringArg("-add");
if (! prop.contains("=")) {
System.err.println("Please supply a property in the form key=... |
cca5d449-adec-4d51-9082-7f8c60c3de03 | 5 | private void listMemberMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMemberMouseClicked
try
{
try
{
int select = listMember.getSelectedIndex();
listMember.setSelectedIndex(select);
String tempFirst = arrayFirs... |
e2b8f020-4911-4eef-b72a-31a92830d0b0 | 7 | public static List<QParameter> getQueryParameters(String queryString) {
if (queryString.startsWith("?")) {
queryString = queryString.substring(1);
}
List<QParameter> result = new ArrayList<QParameter>();
if (queryString != null && !queryString.equals("")) {
String[] p = queryString.split("&");
for (S... |
7285c258-3087-46c8-ad9b-d86ef5b211f7 | 7 | public static synchronized void setCodec( String extension,
Class iCodecClass )
throws SoundSystemException
{
if( extension == null )
throw new SoundSystemException( "Parameter 'extension' null in ... |
afed5d52-715a-4d27-8174-531d3d51a739 | 5 | @SuppressWarnings("unchecked")
private IRandomAccessor2<T> createRandomAccessor(Object source)
{
if(source instanceof List<?>)
{
return new ListRandomAccessor((List<T>)source);
}
else if (source.getClass().isArray())
{
return new ArrayRandomAccessor((T[])source);
}
else if(source instanceof ArrayI... |
df0a4c49-8f70-4eb1-9f73-2137024f974e | 3 | private void relax(EdgeWeightedDigraph G, Vertex v)
{
for (WeightedDirectedEdge e : G.adj(v.label))
{
Vertex w = vertex[e.to()];
if (w.distTo > v.distTo + e.weight())
{
w.distTo = v.distTo + e.weight();
w.edgeTo = e;
if (!w.onQ)
{
queue.addFirst(w);
w.onQ = true;
}
}
}
... |
11d48a75-3ebb-41f7-9526-47ab26001793 | 4 | private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9)) {
... |
63b20f27-6c0a-4504-b9e8-b828cdf4edc2 | 3 | public static byte[] mix(Voice[] voices, int bufferSize) {
byte[] mixedOutput = new byte[bufferSize];
for (int i = 0; i < voices.length; i++) {
if (voices[i].isInUse()) {
byte[] voiceFrame = voices[i].getNextFrame(bufferSize);
for (int j = 0; j < bufferSize; ... |
9552695d-b86d-46f1-9e77-33182826d2e3 | 2 | private void doViewAlLFS(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pageNum = StringUtil.toString(request.getParameter("pageNum"));
if("".equals(pageNum)) {
pageNum = "1";
}
try {
Pager<LianXiWoMen> pag... |
0ad3ffa6-ad1b-4a91-97bc-6fb6b28b4405 | 0 | protected int getPort() {
return port;
} |
ee8fdd43-026e-4b2e-a75c-f6d2855ac2d2 | 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... |
7a601c0b-834f-4dc7-8718-bc4ef1c3c2bc | 5 | @Override
void removeNode(final Node node)
{
if (this.isInGroundTruth())
{
assert this.getNodeCount() > 1;
int gtIndexOfRemovedNode = node.getGtClIndex();
// remove from pseudo cluster
this.graph.getPseudoCluster().removeNode(node);
/*
* Remove node from adjacency list.
* The last node w... |
56798a14-1408-4bc4-8dc9-e78fd0e9a1d4 | 9 | static void checkFrameValue(final Object value) {
if (value == Opcodes.TOP || value == Opcodes.INTEGER
|| value == Opcodes.FLOAT || value == Opcodes.LONG
|| value == Opcodes.DOUBLE || value == Opcodes.NULL
|| value == Opcodes.UNINITIALIZED_THIS)
{
... |
6e335250-90f3-4b70-adbe-991a4b537607 | 4 | private void cpu2() {
switch (this.getGeneratoreRouting().getNextRoute()) {
case IO:
if (this.getIo().isFree()) {
this.getIo().setFree(false);
this.getIo().setJob(this.getCpu2().getJob());
this.getCpu2().setJob(null);
... |
1dab8216-2c8a-4df9-b0fb-95d25ee3b2f6 | 3 | public void actionPerformed(ActionEvent ev)
{
try
{
FonteFinanciamento objt = classeView();
if (obj == null)
{
long x = new FonteFinanciamentoDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION... |
3160f08f-67c8-45e5-8b37-776330940c6a | 6 | public static Node merge(Node l, Node r) {
Node p1 = l;
Node p2 = r;
Node newHead = new Node(100);
Node pNew = newHead;
while (p1 != null || p2 != null) {
if (p1 == null) {
pNew.next = new Node(p2.val);
p2 = p2.next;
pNew = pNew.next;
} else if (p2 == null) {
pNew.next = new Node(p... |
fc7a269e-041c-426f-8fae-8852e76a4542 | 0 | public void addVisitor(Element element) {
elements.add(element);
} |
46e45b92-b417-4796-b45d-e6fedf4b1904 | 9 | private void installNodeDefault() throws InstallationException {
try {
final String longNodeFilename =
this.config.getPlatform().getLongNodeFilename(this.nodeVersion, false);
String downloadUrl = this.nodeDownloadRoot
+ this.config.getPlatform().getNodeDow... |
d8af48de-b46c-4360-9c87-7ca3cc493361 | 9 | public List<Integer> findMinHeightTrees(int n, int[][] edges) {
List<Integer> leaves = new ArrayList<Integer>();
if (n <= 0) return leaves;
if (n == 1) {
leaves.add(0);
return leaves;
}
List<Set<Integer>> adj = new ArrayList<Set<Integer>>(n);
for (int... |
c2a8d24f-1528-41d7-b667-eca2a9beb6b1 | 8 | private int helper(int m, int n, int[][] men, int[][] grid) {
if (n <= 0 || m <= 0) {
return 0;
}
if (m == 1 && n == 1) {
return grid[0][0];
}
men[0][0] = grid[0][0];
for (int i = 1; i < m; i++) {
men[i][0] = men[i - 1][0] + grid[i][... |
2c94b9d7-5e13-45b2-93de-b306f4a1e5ff | 2 | private static void init() {
// Initialize any uninitialized globals.
command = new String();
stillPlaying = true;
// Set up the location instances of the Locale class.
FirstFloor loc0 = new FirstFloor(0);
loc0.setName("Living Room (Shop)");
loc0.setDesc("You are... |
633802ef-7a13-47ae-b511-dfd15f9162ba | 1 | static ClassType make(String s, int b, int e,
TypeArgument[] targs, ClassType parent) {
if (parent == null)
return new ClassType(s, b, e, targs);
else
return new NestedClassType(s, b, e, targs, parent);
} |
aa1f5fa2-6ed5-4120-8595-e593dfe83434 | 7 | private var_type eval_exp10() throws StopException, SyntaxError {
var_type result;
var_type partial_value;
String op;
result = eval_exp11();
op = token.value;
while( op.equals("<") || op.equals("<=") || op.equals(">") || op.equals(">=") ){
token = lexer.get_token();
partial_value = eval_exp... |
2ee73d64-0347-480f-875b-2268db2544cb | 6 | public void readFirst(){
synchronized (lock1) {
String sCurrentLine;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("E:/Intern/Java/workspace/Translator/src/translator/first.txt"));
while (!((sCurrentLine = br.readLine()).equals(""))) {
//System.out.println(sCur... |
c69181aa-645e-450b-a6ef-b786550935d3 | 1 | public void visit_fcmpg(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
0044a8f5-3574-49b0-815b-12aaaca7143b | 8 | protected void testsWithoutClass(boolean weighted,
boolean multiInstance) {
boolean PNom = canPredict(true, false, false, false, false, multiInstance, NO_CLASS)[0];
boolean PNum = canPredict(false, true, false, false, false, multiInstance, NO_CLASS)[0];
boolean PStr... |
bf6dbb66-c28d-4542-9971-79057056757b | 8 | private void prepareItems(Composite parent) {
Composite composite = createDefaultComposite(parent);
/*
* ---------------- server name
*/
Label serverLabel = new Label(composite, SWT.NONE);
serverLabel.setText(SERVERNAME_TITLE);
serverText = new Text(composite, SWT.SINGLE | SWT.BORDER);
// creo il... |
53ec637c-70dd-4fc5-bbc3-002198b6b78b | 8 | * @param artist2
* @throws IOException
*/
public void checkPair(String artist1, String artist2){
String concat12 = artist1.concat(artist2);
String concat21 = artist2.concat(artist1);
Pair found;
if(this.pairMap.containsKey(concat12)){
found = this.pairMap.get(concat12);
if(found.occurences<50){
... |
1d7bb366-24d6-4292-9c4c-bd975b1f94e4 | 5 | private int stripMultipartHeaders(ByteBuffer b, int offset) {
int i;
for (i=offset; i<b.limit(); i++) {
if (b.get(i) == '\r' && b.get(++i) == '\n' && b.get(++i) == '\r' && b.get(++i) == '\n') {
break;
}
}
return i + 1;
... |
6d397a01-82fd-4413-9b09-52a0ac26f4eb | 1 | public int sumNumbers(TreeNode root) {
if(root == null) return 0;
sumNumbersRec(root, 0);
return this.res;
} |
41e30931-5995-454b-88f8-7f88852765a0 | 4 | public String getTypeName(){
switch(_type){
case 0: return "DivX Standard";
case 1: return "DivX Standard";
case 4: return "H.264 Mobile";
case 5: return "H.264 Standard";
default : return "No Type Set";
}
} |
512fcc87-191f-423b-98c1-14133fdd557c | 0 | public void setEncryptionKey(KeyInfoType value) {
this.encryptionKey = value;
} |
7a563ec7-e64f-45a0-9cd1-94ddc363a24c | 3 | @Override
public void bind ( SocketAddress endpoint, int backlog ) throws IOException {
if ( isClosed() )
throw new SocketException("Socket is closed");
if ( isBound() )
throw new SocketException("Already bound");
if ( ! ( endpoint instanceof AFUNIXSocketAddress ) ) {... |
d185870a-d314-4ed9-b988-2ed75012348d | 0 | public void addQuizDataObjectArray(QuizDataObject [] tqDBArray)
{
getGraphPanel().setQuizListFromArray(tqDBArray);
} |
16597a50-b57d-4a00-a226-a5f47892abbe | 6 | public TreeMap<Double,Object> kNN(DatasetObject objectQuery, int k) {
TreeMap res=null;
res=new TreeMap();
for(int i=0; i<dataset.size()&&getDataset().getObject(i)!=null;i++)
{
double dist=distance(objectQuery,getDataset().getObject(i));
Integer o=Int... |
4db213a2-9041-4382-b115-cb8da45f15b7 | 9 | private boolean putsKingInCheck(Board board, Location intendedLocation) {
boolean inCheck = false;
for(Piece p : board.getAllPieces()) {
if (p.getColor() != this.getColor() && !p.isCheckable()) {
for (Move m : p.getMoves(board)) {
Piece endPiece = board.ge... |
6e8b8604-ce4f-446c-aeb1-7ee8d918613e | 9 | @Override
public void populate( World world, Random random, Chunk chunk )
{
//if (true) return;
if (gen1 == null)
{
int numOctaves = 2;
gen1 = new SimplexOctaveGenerator(world, numOctaves);
gen1.setScale(1/128.0);
}
//float density = minDensity + ((float)((gen1.noise(chunk.getZ() * 16 + 8192,... |
cbc58c96-2aea-4a72-ad4d-3ca55eef3ea6 | 0 | public void setIsLayer(boolean isLayer) {
this.isLayer = isLayer;
} |
83e42334-60c9-45db-8f1f-4ff7383d7a66 | 5 | private int distanceToBase() {
Integer distance = null;
for (Unit base : self.getUnits()) {
if (base.getType() == UnitType.Terran_Command_Center) {
int dist = resource.getDistance(base);
if (distance == null || dist < distance) {
distance = dist;
}
}
}
if (distance != null) {
... |
d20f22d8-9275-4dfe-8d87-0b6c0fb6534f | 7 | @org.junit.Test
public void testPut()
{
BiHashMap< Integer, String > map = new BiHashMap< Integer, String >();
Integer key = null;
String value = null;
// Add entry to map and ensure its existence
value = map.put( 1, "One" );
as... |
ca432930-f3df-455e-bf7d-c3d4745605f9 | 1 | public void visitLookupSwitchInsn(
final Label dflt,
final int[] keys,
final Label[] labels)
{
mv.visitLookupSwitchInsn(dflt, keys, labels);
if (constructor) {
popValue();
addBranches(dflt, labels);
}
} |
b834e31a-4891-4f6c-9003-7681c98fa3f7 | 9 | public NPC[] getSpawns()
{
int npcs[] = new int[6];
int index = 0;
int id = stage;
for(int i = 6; i >= 1; i--)
{
int threshold = (1 << i) - 1;
if(id >= threshold)
{
for(int j = 0; j <= id / threshold; j++)
{
... |
63aabfc0-60c2-46f9-adc6-03770c4d7896 | 0 | public void request()
{
System.out.println("From Real Subject !");
} |
3cdd3061-67c4-4149-86b7-229f3195db99 | 0 | public String getSaveFileFormat() {
return (String) saveFormatComboBox.getSelectedItem();
} |
60516e00-c847-41c4-917d-361e9c3d88d3 | 2 | @Override
public void update(long deltaMs) {
if(!spawned) {
GameSector s = Application.get().getLogic().getGame().getSector(sector);
if(s.free()) {
s.spawnEnemy(resource);
spawned = true;
}
}
} |
fc026a65-68f5-421c-934c-9b477316606b | 4 | public void testCreateWanted() {
for (HTML.Tag t : HTMLParser.getWantedSimpleTags()) {
HTMLComponent comp = HTMLComponentFactory.create(t, null);
Class<?> cl = HTMLComponentFactory.classForTagType(t);
assertSame(comp.getClass(), cl);
}
for (HTML.Tag t : HTMLParser.getWantedComplexTags()) {
HTMLCompone... |
45c84ea9-555e-498b-860a-8ef03d9e030d | 6 | public static boolean checkPositionInside(Element element, int x, int y) {
// ignore x / left-right values for x == -1
if (x != -1) {
// check if the mouse pointer is within the width of the target
int left = DomUtil.getRelativeX(x, element);
int offsetWidth = eleme... |
82f80649-3fbf-44d9-b46a-ff86dc3c956d | 1 | public void visitLineNumber(final int line, final Label start) {
buf.setLength(0);
buf.append(tab2).append("LINENUMBER ").append(line).append(' ');
appendLabel(start);
buf.append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitLineNumber(line, star... |
d07542c4-9d9f-4900-bf42-203bbd1136bd | 3 | public GUIInventoryWindow(int id, String name, Inventory inventory, int WorldX, int WorldY, int across) {
super(id, name);
linksTo = inventory;
this.WorldX = WorldX;
this.WorldY = WorldY;
this.Width = (across * 34) + 4;
this.Height = ((linksTo.getInventorySize() / across) * 34) + 8;
int j = 0;
int... |
bec62ef2-0918-419e-8667-e3f6ffbbffa1 | 3 | public static void zip(String filepath){
try
{
File inFolder=new File(filepath);
File outFolder=new File("Reports.zip");
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFolder)));
BufferedInputStream in = null;
byte[] data = new byte[1000];
... |
24db2ff3-ae37-498e-a784-c5adbe5dbd07 | 8 | public void setDay(int day){
buttonArray.get(1).getDay().doClick();
if(buttonArray.size()-1 < day){
for(int x = 0; x < day+1; x++){
while(timer.isRunning()){} //This will delay the method until timer has ran out
if(!buttonArray.containsKey(x)){
this.createNewDay();
}
}
} else if(buttonArray... |
f3737209-edf1-4cc1-b3cd-fb64395323fd | 4 | @Override
public void setStackInSlot(int slot, ItemStack stack) {
if(inventory[slot] == null)
inventory[slot] = stack;
else if (stack == null && inventory[slot] != null)
inventory[slot] = null;
else if(inventory[slot].getItem().equals(stack.getItem()))
inventory[slot].stackSize += stack.stackSize;
els... |
d3d6e442-7f54-496c-a14e-065823291b85 | 4 | public LevelReader(World world, File path) {
try {
Document document = new SAXBuilder().build(path);
Element rootNode = document.getRootElement();
List blocks = rootNode.getChildren("block");
List flags = rootNode.getChildren("flag");
//Blokken
... |
881b0db3-e873-45f9-8518-7e3652d72277 | 6 | @SuppressWarnings("deprecation")
@Override
public void updateContent(IDocument myDocument, List<String> myWordList) {
//Start analysis here...
if(myDocument==null){
new_analyse.setEnabled(true);
return;
}
profileInformation = connector.getProfileInformation(userID);
AnalyzeTaskInformation task = new A... |
b9837621-1093-4907-9cd8-652026103936 | 3 | public ArrayList<FormEvent> resultQuery(String sql){
ArrayList<FormEvent> dbList = new ArrayList<FormEvent>();
try {
rs = stm.executeQuery(sql);
try {
while(rs.next()){
FormEvent item = new FormEvent(this);
item.setId(rs.getInt("idTrabajador"));
item.setEmpTipo(rs.getInt("tipoEmpleado_Id")... |
726a0296-2694-462e-ae02-62ff1df478de | 1 | @Override
public String getStringProp(String key, String value) {
String result = (String) get(key);
if (null == result)
result = value;
return result;
} |
8c46d33c-46a1-42a3-bedd-069a58adcb58 | 0 | public LLParseController(LLParsePane pane) {
this.pane = pane;
productions = pane.grammar.getProductions();
} |
666e7ab1-7c04-44b7-8cc9-fb27cf8a6b63 | 0 | public ArrayList<String> getRivit() {
return rivit;
} |
51208ee6-aca2-4207-af18-9446697b3abb | 8 | public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-undo")) showUndo = true;
if (args[i].startsWith("-goToMultiplayer")) multi = true;
}
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
... |
7fb52cf9-0e6f-4c16-b6ec-efa8485b0703 | 5 | private static int[] getFirstK(double[] sum, int k) {
Map<Integer, Double> m = new TreeMap<Integer, Double>();
for (int i = 0; i < sum.length; i++) {
m.put(i, sum[i]);
}
List<Map.Entry<Integer, Double>> mappingList = null;
mappingList = new ArrayList<Map.Entry<Integer... |
b94ca5fe-e193-4298-8f58-7b964ab4e692 | 3 | public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace... |
7d35f9b4-b053-46dc-86fd-bf7ce3311c02 | 2 | public ArrayList<Trajet> getTrajetsWithPassager(Membre m){
ArrayList<Trajet> res = new ArrayList<Trajet>();
for(Trajet t : listeTrajets){
if(t.hasMembreAsPassager(m)){
res.add(t);
}
}
return res;
} |
0d17212d-a081-4caf-a0cd-bdc4bdac96d7 | 2 | public QuickFind(List<ConnectedPair> list) {
numbers = new int[list.size()];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = i;
}
for (ConnectedPair pair : list) {
connect(pair.getFirst(), pair.getSecond());
}
} |
8f72ff79-3750-4131-94d7-caa9461f048f | 9 | public void updateWith(Instruction currentExecuting)
{
if (inst.workingOperands.size()>1 && inst.instructionType==0)
{
for (int i=1; i<inst.operands.size(); i++)
{
String s = inst.operands.get(i);
if (s.equals(currentExecuting.destinationRegister))
{
// Need to circulate the result
... |
63cc3911-921b-498d-913f-533e58bd9480 | 4 | private List<List<Integer>> getAllChains(int currentVertex)
{
List<List<Integer>> chains = new ArrayList<List<Integer>>();
if(countConnections(currentVertex) > 2 || isEdgeNode(currentVertex))
{
for(int neighbor = gameBoard.first(currentVertex); neighbor < gameBoard.vcount(); neighbor = gameBoard.next(curre... |
500cea70-b1eb-42d0-9f57-37a1e0e2d2ed | 2 | public Iterator<T> iterator() {
return new Iterator<T>() {
MyList<T> next = first;
MyList<T> node = null;
@Override
public boolean hasNext() {
return (node != last);
}
@Override
public T next() {
if (next == null)
throw new NoSuchElementException();
node = next;
... |
dfe890c8-716b-4e9f-9efd-4a55b434b0f7 | 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... |
3aa8c572-0b0d-4e54-b9c4-ba77ab5894d7 | 1 | public void setReachable() {
if (!reachable) {
reachable = true;
setSingleReachable();
}
} |
0bcd36b0-19a0-485b-84c3-74f79802bdfe | 3 | public void run ()
{
boolean fini = false;
try
{
// recevoir requete
String maLigne;
String ligne = maLigne = reader.readLine();
//Consommer l'entête du browser
while (!ligne.equals(""))
{
ligne = reade... |
98b866fd-c94c-45be-b421-635e19d1e86d | 6 | @Override
public FileBlob getBlob(String name) throws FileNotFoundException {
if( !name.startsWith(HEAD_URN_PREFIX) ) {
throw new FileNotFoundException(getClass().getName()+" only finds "+HEAD_URN_PREFIX+"s! Not '"+name+"'.");
}
name = name.substring(HEAD_URN_PREFIX.length());
if( name.startsWith("//") ... |
947b3d15-bf8d-4352-9cdd-97d7bb5db102 | 2 | private Tree programPro(){
Tree element = null;
Tree program = null;
if((element = elementPro())!=null){
if((program = programPro())!=null){
return new Program(element, program);
}
return element;
}
return null;
} |
758d4af4-3c82-4e7a-80df-b78594fce40d | 7 | String consumeHexSequence() {
int start = pos;
while (pos < length) {
char c = input[pos];
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
pos++;
else
break;
}
return new String(input, sta... |
44c21891-bf97-4c47-89cc-3629be4663ad | 3 | public boolean collisionHead(Obstacle[][] obs,int i, int j, int k) {
if (i < 0)
return false;
boolean collide = obs[i][j].CollisionBot(); // box at his head
while (k<width){ // try all boxes on Stubi's head line
collide |= obs[i][++j].CollisionBot();
k += Obstacle.getWidth();
}
if (collide) {
... |
f5e42948-0035-486e-9d59-d135a41ce177 | 3 | private List<MessageSwitch> parseSwitches(final ConfigurationSection switches, final String path) {
if (switches == null) return Collections.emptyList();
final ConfigurationSection section = switches.getConfigurationSection(path);
if (section == null) return Collections.emptyList();
fi... |
4c8ed297-87de-4a26-aa65-77e387bf3720 | 3 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Activity activity;
if (rowIndex < activities.size()) {
// Get the Activity from the indicated row.
activity = activities.get(rowIndex);
// Get the appropriate field from the columnIndex
if (columnIndex == columnNames... |
aa0f40a7-2b75-423a-9dae-b4ee726dae27 | 5 | public void dayTransition() {
if (dayTime == true) {
darkness = darkness - .03f;
if (darkness < 0) {darkness = 0;}
}
else {
darkness = darkness + .03f;
if (darkness > .95f) {darkness = .95f;}
}
... |
e4ea5555-eba4-401f-b92d-eaf021fdceaa | 2 | void crawler (String URL){
try {
URL my_url = new URL("http://www.vimalkumarpatel.blogspot.com/");
BufferedReader br = new BufferedReader(new InputStreamReader(my_url.openStream()));
String strTemp = "";
while(null != (strTemp = br.readLine())){
Syste... |
ebcc3e87-3c98-4b55-8c99-b3ed2b6c29d6 | 4 | public Message poll(EnumMessageType type) {
switch(type) {
case PROCESS:
return hasMessageToProcess() ? MessageDispatchManager.inboundMessageMap.get(getName()).poll() : null;
case SEND:
return hasMessageToSend() ? MessageDispatchManager.outboundMessageMap.get(getName()).poll() : null;
}
return null;
... |
b0cff0e4-4790-417e-bd13-9863590525e4 | 6 | public boolean removeAll(Collection<?> c){
if(c.isEmpty() || c == null)
return false;
boolean modStatus = false;
for(int i = 0; i < size; i++){
if(c.contains(elements[i])){
remove(i);
i--;
modStatus = true;
}
}
return (modStatus)? true : false;
} |
88e4b5d1-3ca5-4beb-a9ad-6ccb4582e467 | 8 | private void replaceState(State state, State replacement) {
if (states.remove(state)) {
if (this.xorJoinState.containsValue(state)) {
Set<XorJoin> keys = xorJoinState.keySet();
for (XorJoin key : keys) {
if (xorJoinState.get(key).equals(state)) {
xorJoinState.put(key, replacement);
}
}
... |
8dbde6a1-d729-4738-9da2-f74206730723 | 4 | Tuple<Markers, Markers> createMarkers(Chromosome chr, int numMarkers) {
Markers markers = new Markers();
Markers markersCollapsed = new Markers();
int start = 0, startPrev = -1, end = 0, gap = 0;
Marker m = null, mcol = null;
for (int i = 0; i < numMarkers; i++) {
// Interval size
int size = rand.nextI... |
8c503475-efcb-446a-b6c6-7d3ef0f34c81 | 9 | public static void checkOverlap(OrderedList<Alignment> rankAlign, double overlapThresh)
{
int i=0, j=0, k=0;
NodeOrdList<Alignment> aux=rankAlign.getMax();
HashSet<String> nodiOverlap=new HashSet<String>();
while(aux!=null)
{
Vector<String>[] mapping=aux.getInfo().getMapping();
double[] overlapping=new... |
b6df609d-4ac0-43aa-9e17-82e3371dae80 | 6 | @Command(aliases = { "info" }, desc = "Gibt Informationen zu Votes von dir oder einen anderen Spieler aus", usage = "[spielername]", max = 1)
@CommandPermissions("nextvote.info")
public final void info(final CommandContext args, final CommandSender sender) throws CommandException {
String playerName = s... |
10694352-26de-4aff-a870-d59a9baaff2d | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
try{
Connection adaugareMembriConn = null;
ResultSet adaugareMembriResult = null;
Statement adaugareMembriStatement = null;
PreparedS... |
ef134830-3fb9-42f8-b124-943ac826e46b | 5 | * @param mt the microtheory from which to delete the matched assertions
*
* @throws IOException if a communications error occurs
* @throws UnknownHostException if the Cyc server cannot be found
* @throws CycApiException if the Cyc server returns an error
*/
public void unassertMatchingAssertionsWithout... |
9f97ac0f-cd3b-4f35-b4a9-a1e002059a2d | 1 | @Override
public void enterState(int id, Transition leave, Transition enter) {
if (gui != null) {
gui.setRootPane(emptyRootWidget);
}
super.enterState(id, leave, enter);
} |
a65da040-494d-4531-935d-fbfb27328a9c | 2 | public void actionPerformed(ActionEvent event)
{
//DB STUFF
try {
if (sendAuthentication())
{
//dispose current panel
dispose();
//You logged in as the manager
ManagerMainMenu menu = new ManagerMainMenu();
menu.setVisible(true);
}
el... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.