method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6861e8a0-eadc-45be-aaee-33f65c68feca | 0 | @Override
public void undo() {
this.to.removePiece(this.promotionedPiece);
this.to.addPiece(this.capturedPiece);
this.from.addPiece(this.piece);
this.piece.decreaseMoveCount();
} |
3f563158-ec8f-4d66-950e-ed8f03c8b5ba | 1 | @Override
public int print(Graphics g, PageFormat pf,
int page)
throws PrinterException {
// We have only one page, and 'page'
// is zero-based
if (page > 0) {
return NO_SUCH_PAGE;
}
// User (0,0) is typically outside the
// imageable area, ... |
04ec46e2-8146-4860-8297-8d74c8465fdb | 4 | public static void main(String s[]) {
testLoop: for (int bits = MIN_BITS ; bits <= MAX_BITS ; bits++) {
final int period = (1 << bits) - 1 ;
final boolean reg[] = new boolean[period] ;
final LFSR lfsr = new LFSR(bits, 1) ;
I.say("\nBeginning test for "+bits+" bit LFSR...") ;
//
/... |
51fb64ad-96cb-4a3f-922c-375e3c51e690 | 1 | public void testIsAfter_YMD() {
YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
assertEquals(false, test1.isAfter(test1a));
assertEquals(false, test1a.isAfter(test1));
assertEquals(false, test1.isAfter(test1));
assert... |
1296d892-530f-4b4b-b237-56f64d9a5a79 | 7 | public void peliSykli() {
while (jatkuu) {
try {
Thread.sleep(viive);
} catch (Exception e) {
status.setText("Jotain meni vikaan...");
}
if (pause) {
while (pause) {
status.setText("Peli pysäytett... |
93ed0afd-4d99-46e9-b2f3-f7729cb87e48 | 8 | public String openSEND() throws IOException{
Transporte t = new Transporte(initTransporteACKeSYN);
Transporte t1 = new Transporte(initTransporteACKeSYN);
seq = 0; //numero de sequencia por defeito para o cliente
mtu = 1400;
win = MINWIN;
//criar SYN (dados ... |
7aedef65-db45-40c8-8294-19d081ef6b80 | 3 | private static void removeFromTrees(TreeNode treeNode, List trees) {
boolean found = false;
// without this initialization, I get a compilation error
// that says subTree may not have been initialized
Tree subTree = new Tree(null, null, null);
for (Iterator iter = trees.iterator(); iter.hasNext(); )... |
ea38b315-1427-470a-a80f-ee17b40d2354 | 3 | @Override
public Event next() {
String input = null;
try {
input = br.readLine();
} catch (IOException e) {
}
if(input == null || input.equals("")){
return new DefaultState(as);
}
else{
return new UserHomeState(as, input);
}
} |
7a4b15a5-0658-412c-9d94-2255901ff98f | 4 | public List<BipolarQuestion> getBipolarList(String oppositeFileName, String teamType) {
List<BipolarQuestion> bipolarQuestionList = new ArrayList<BipolarQuestion>();
Element bipolarQuestionE;
BipolarQuestion bipolarQuestion;
BipolarQuestionDao parentBipoarQuestion = new BipolarQuestionDao(oppositeFileName);
... |
4a0385b3-6ddf-455a-b38f-97068a50b560 | 1 | public int h() {
return _map == null?0:_map.length;
} |
5c66e78b-3ce5-4354-8c88-994be55bda7f | 9 | public List<Location> adjacentLocations(Location location)
{
assert location != null : "Null location passed to adjacentLocations";
// The list of locations to be returned.
List<Location> locations = new LinkedList<Location>();
if(location != null) {
int row = location.ge... |
84572692-7c93-447f-8499-80b042979b22 | 2 | public void setColor(int i) {
String strat = agents[i].getStrategy();
for(int str = 0; str < scape.strategies.length; str++) {
if(strat.equals(scape.strategies[str])) {
style[(i + 2)] = colors[str];
}
}
} |
fe19869c-41cd-472a-8fc4-83b3de561a6b | 6 | public static NumberWrapper plusComputation(NumberWrapper x, NumberWrapper y) {
{ double floatresult = Stella.NULL_FLOAT;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(x);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper x000 = ((IntegerWrapper)(x));
... |
fc3a9226-09b1-4218-87b3-a00b1d08dbad | 0 | Announce(SharedTorrent torrent, byte[] id, InetSocketAddress address) {
//> obfuscated handshake extension
this.torrent = torrent;
this.id = id;
this.address = address;
this.listeners = new HashSet<AnnounceResponseListener>();
this.thread = null;
this.register(this);
} |
1cd17f21-9fe8-48c0-8506-e1b4b5bd69d3 | 7 | public static void readFile(String filePath) {
lineCode lineType = lineCode.amount;
try {
FileInputStream fstream = new FileInputStream(filePath);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine =... |
db10a280-0f2a-474c-8681-7f106763fbbc | 2 | public static ActionCom SelectActionComById(int id) throws SQLException {
String query = null;
ActionCom Action = new ActionCom();
ResultSet resultat;
try {
query = "SELECT * from ACTION_COM where ID_ACTION=? ";
PreparedStatement pStatement = ConnectionBDD.getIn... |
2d455959-1687-40b0-8a6c-4273c9c433dc | 5 | public void undo() {
if (patchIndex == 0) {
return;
}
UndoPatch p = undoPatches.get(--patchIndex);
// Reverse patch
int prow;
for (prow = 0; prow < p.patchText.length; prow++) {
if (prow >= p.oldText.length) {
for (int da = p.patchText.length - prow; da > 0; da--) {
... |
6f807a33-a832-4c76-b092-4fdb94f2d8ad | 7 | private void processInput(String incoming) {
String[] split = incoming.split(";");
String command = split[0].toUpperCase();
if (command.equals("NEWUSER")) {
this.clientCon.getUser().addUser(split);
} else if (command.equals("MESSAGE")) {
} else if (command.equals("LOGIN")) {
this.clientCon.getUser().ve... |
fb8749f5-ea4b-4a44-8dc5-2a20c36cf913 | 6 | private static void initDisplay(boolean fullscreen) {
DisplayMode chosenMode = null;
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i++) {
if ((modes[i].getWidth() == targetWidth) && (modes[i].getHeight() == ta... |
f2e2946a-05d2-4672-be88-16d4eb7136ef | 6 | public static double getDamageModSlash(WeaponMaterial type) {
switch (type) {
case COPPER:
return 0.5;
case BRONZE:
return 0.75;
case SILVER:
return 0.5;
case IRON:
return 1;
case STEEL:
... |
69ae659b-2a21-4e36-b171-6bb65efa84df | 0 | public JLabel getjLabel3() {
return jLabel3;
} |
d2869b8a-b4fa-456b-bd1c-cb9b90b5af98 | 9 | public void buildBoard(){
Wall wall;
Cheese cheese;
Intersection intersection;
for(int i = 0; i < levelData.length; i++){
switch(levelData[i]){
case 1:
wall = new Wall(i-((i/21)*21),i/21);
collisionList.add(wall);
paintList.add(wall);
break;
case 2:
cheese = new Che... |
685f2bd7-da1d-4719-a081-8b44fea65aad | 1 | public List<Author> getAuthor() {
if (author == null) {
author = new ArrayList<Author>();
}
return this.author;
} |
0f85c36a-1d42-4441-90b5-96a689df42c1 | 7 | public static int bitonicSearch(Comparable[] a, int lo, int hi, Comparable t) {
if (lo > hi) {
return -1;
}
int mid = (lo + hi) / 2;
final int compareToT = a[mid].compareTo(t);
if (compareToT == 0) {
return mid;
} else if (compareToT == 1) { // mid... |
8efaf977-6fd7-458c-b20a-f3c815e5ed1f | 0 | public void setAcceptByEmptyStack() {
myAcceptance = EMPTY_STACK;
} |
364d5190-9c13-4f28-81df-e5335517e92b | 3 | public ColourMap(Colour[] colours, String name) {
InitMap(); //First initialises array to null.
if (colours.length <= m_mapSize) {
/* Then if array parameter is <= max number of maps */
for (int i=0; i<colours.length; i++) {
SetColour(i, colours[i]); //tr... |
720504ea-7808-4645-8429-d68ae318e4b2 | 7 | protected boolean isPrimitiveWrapper(Object input) {
return input instanceof Integer || input instanceof Boolean ||
input instanceof Character || input instanceof Byte ||
input instanceof Short || input instanceof Double ||
input instanceof Long || input instanceo... |
db1f5568-6ade-4507-9fc5-865e7042165c | 1 | ArrayList<Row> getChildList() {
return canHaveChildren() ? mChildren : null;
} |
aaf0033d-4d11-4e59-bdf6-e685acbe9250 | 9 | static public void list() {
String[] available_inputs = availableInputs();
String[] available_outputs = availableOutputs();
String[] unavailable = unavailableDevices();
if(available_inputs.length == 0 && available_outputs.length == 0 && unavailable.length == 0) return;
System.out.println("\nAvailable MI... |
4e206f5c-661b-4b52-afe6-8c2fc9e4e5d5 | 0 | public void stopListening() {
listening = false;
} |
b835d71f-fe5b-4d61-aa21-4cdf5275a6c6 | 4 | public void playerTurn() {
int choice = 1;
boolean readChoice = true;
System.out.println("\n------------------------------");
System.out.println("PLAYER'S TURN");
System.out.println("------------------------------");
while (readChoice) {
choice = getInt("Which column would you like to drop your pie... |
f0b201d2-c2d1-4a07-8865-014371da6efb | 4 | @Override
public void validate() {
if (platform == null) {
addFieldError("platform", "Please Select Platorm");
addActionError("Please Select Platorm");
}
if (location == null) {
addFieldError("location", "Please Select Location");
addActionEr... |
b3bc592b-d0c5-4574-8433-3733464ca6ba | 7 | static boolean nextPermutation(List<Integer> a){
int[]p = new int [a.size()];
for (int i = 0; i < p.length; i++) {
p[i]=a.get(i);
}
int k,l,aux,i,j;
for (k = p.length-1; k>0 && p[k-1]>=p[k]; k--);
if (k!=0){
for (l = p.length-1; l>0 && p[k-1]>=p[l]; l--);
aux=p[k-1]; p[k-1]=p[l]; p[l]=aux;
for... |
4ac685a0-3f5d-45fd-80b1-fde1e485be5d | 7 | public static int partition(int[] records, int low, int high){
if(low > records.length - 1|| high > records.length - 1) {
throw new IllegalArgumentException();
}
int pivot = records[low];
while(low < high){
while (records[high] > pivot && low < high){
... |
53256dac-bfb0-456f-ad93-79be65e7788f | 3 | private boolean jj_3R_55() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_62()) {
jj_scanpos = xsp;
if (jj_3_63()) {
jj_scanpos = xsp;
if (jj_3_64()) return true;
}
}
return false;
} |
f1d4b2c6-1eb8-40cf-bb94-749cea1d3451 | 0 | public void setjButtonNext(JButton jButtonNext) {
this.jButtonNext = jButtonNext;
} |
c298d8da-13e5-4069-808e-0634c42857a9 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Modul))
return false;
Modul other = (Modul) obj;
if (bezeichnung == null) {
if (other.bezeichnung != null)
return false;
} else if (!bezeichnung.equals(other.bezei... |
da35e018-d64e-4b6f-89ca-ac4e57b6d900 | 5 | private static void addList(ArrayList<Node> list, ArrayList<Node> newList) {
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getWeight() <= Config.size){
if (!newList.contains(list.get(i))) {
newList.add(list.get(i));
if (table.containsKey(list.get(i).getWeight())) {
if (!table.get(list.get(... |
0f4ad229-a3b9-4254-aa15-c07c9d4af948 | 0 | public void SetStopBusStop(int stopBusStop)
{
//set the person stop bus stop
this.stopBustop = stopBusStop;
} |
83bc397b-2be9-44ab-a131-2ef50a653a00 | 0 | public String getNumBalise() {
return numBalise;
} |
31730430-37ec-447b-940c-ef7a3224665c | 3 | public Connection getConnection()
{
try
{
if(connection==null||connection.isClosed())
connection =
DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/workdb");
}catch(SQLException ex)
{
ex.printStackTrace();
}
return connection;
} |
b3fd2225-1fa7-417b-afde-3ba2e6493a1c | 1 | private boolean jj_2_19(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_19(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(18, xla); }
} |
70a9b30d-3243-4213-aaf2-0343ba00aacb | 6 | public ListNode deleteDuplicates(ListNode head) {
ListNode dummy = new ListNode(0);
dummy.next = head;
ListNode p = dummy;
if(head == null) return head;
while(p.next != null){
int cur = p.next.val;
ListNode pp = p.next;
if(pp.next == null || p... |
f09e9c8d-8bb5-4074-bcbc-6db8839c1258 | 1 | public int length() {
int length = 2 + 2 + 4 + code.length + 2 + handlers.length * 8 + 2;
for (int i = 0; i < attrs.length; i++) {
length += 2 + 4 + attrs[i].length();
}
return length;
} |
93311e16-7b9a-4c43-a799-fbbc04ebb699 | 8 | @Override
public List<AdminCol> getColSortList(String tblNm) {
log.debug("get column sort list for table = " + tblNm);
Connection conn = null;
PreparedStatement statement = null;
ResultSet rs = null;
ArrayList<AdminCol> list = new ArrayList<AdminCol>();
StringBuilder sql = new StringBuilder();
sql.app... |
82b825ec-0b83-4244-85ae-5bb0130516ea | 6 | public void draw(Graphics2D g){
if(bulletTime&&btTimer > 0&&!btCooldown){
try {
System.out.println("BULLET TIME");
Thread.sleep(btTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}else if(btTimer == 0){
btCooldown = true;
}
if(gameStates[currentState] != null){
gameSta... |
501e95d2-9b83-4b01-b0fc-0d78ecd1a139 | 4 | public IService getService(Type type)
{
switch (type) {
case ALBUM:
return new AlbumService(this.daoFactory.getAlbumDAO());
case ARTIST:
return new ArtistService(this.daoFactory.getArtistDAO());
case TRACK:
return new TrackS... |
2efa85ff-0994-47fe-8d15-00e83b9d900b | 9 | public static Cons collectStartupFormsFromSystemFile(SystemDefinition system) {
{ String systemfilename = Stella.makeSystemDefinitionFileName(system.name);
Module module = null;
Cons startupform = null;
Cons startupforms = Stella.NIL;
{ Object old$Module$000 = Stella.$MODULE$.get();
... |
c4352e63-97bb-4f6e-baef-ae8b1e81840c | 2 | public static void main(String[] args) {
int[][] array = new int[3][4];
int index=1;
for(int i =0; i< 3;i++)
for(int j =0; j < 4;j++){
array[i][j] = index++;
}
List<Integer> list = new Spiral_Matrix().spiralOrder(array);
System.out.println... |
1a6d890e-9d68-4831-8611-7b0c7935cd1f | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
987f5279-2455-47ff-96d5-49a75386cba0 | 5 | public Action decideAction(Set<Being> beings, BehaviourType behaviourType) {
Action a;
double hunger = myBeing.getDynamicStats().get(StatType.D_HUNGER).getValue();
if (myBeing.childReady()) {
if (Math.random() > 0.9) {
a = new BearAction(myBeing);
} else {... |
cc948085-c577-471b-83e8-36fab1f1ea99 | 1 | public void printAnalysisResultsSummaryEP() {
String string = "";
for (int i = 0; i < consumptionEnergyPoints.length; i++)
string += "\t\tFR" + (i + 1) + ": " + consumptionEnergyPoints[i] + "EP\n";
string += "\n\t\tTOTAL : " + systemConsumptionEP + "EP";
System.out.println(string);
} |
b0382bf6-0b25-44f0-b53e-bfbd8acad454 | 5 | public void loadAllGroups() {
ResultSet data = query(QueryGen.selectAllGroups());
while (iterateData(data)) {
HashMap<PermissionFlag, Boolean> flags = new HashMap<PermissionFlag, Boolean>();
String groupType = getString(data, "GroupType");
String groupId = getString(d... |
a4099ec4-e0ed-42bd-a398-9ecc90b711b0 | 1 | @Override
public void paint(Graphics g) {
super.paint(g);
for (JComponent voie : voies) {
voie.paint(g);
}
} |
a74c43e3-1416-433b-b83d-4c566f32a0a4 | 7 | @Override
public void run()
{
playing = true;
orderedStopped = false;
try
{
if ((clip != null) && (applet instanceof Applet))
{
if (url == null)
clip = ((Applet) applet).getAudioClip(((Applet) applet).getCodeBase(), key);
else
clip = ((Applet) applet).getAudioClip(new URL(url + key));
... |
353707aa-25ee-4e2c-9f54-06d41fdd8b3b | 4 | public static UUID toUUID(String value)
{
if (value == null || value.length() < 32)
{
return null;
}
try
{
if (!value.contains("-"))
{
String fixedString = value.substring(0, 8) + "-" + value.substring(8, 12) + "-" + value.substring(12, 16) + "-"
+ value.substring(16, 20) + "-" + value.su... |
feb002e6-0d04-46e9-89e1-a612102c3cb3 | 8 | @Override
public void validate(Object target, Errors error) {
// TODO Auto-generated method stub
Contact contact=(Contact) target;
String firstName=contact.getFirstName();
String lastName=contact.getLastName();
if(firstName==null || firstName.trim().equals("")){
ValidationUtils.rejectIfEmpty(error, "fi... |
26b78dc1-dad7-4a50-bcab-bd7d5c1f27e8 | 4 | public void setOption(int token){
if( token == 0){
if( this.option > 0)
option -- ;
else
option = this.optionStr.length - 1 ;
}else if( token == 1){
if( this.option < this.optionStr.length - 1)
option ++ ;
else
option = 0 ;
}
} |
771da74e-017d-4906-8098-8504a8cc8d11 | 6 | @Override
public XValue invoke(XRuntime runtime, XExec exec, int id, XValue thiz, XValue[] params, List<XValue> list, Map<String, XValue> map){
XObjectDataMap m = (XObjectDataMap)runtime.getObject(thiz).getData();
switch(id){
case 0:
return getIndex(runtime, m, params[0]);
case 1:
return length(m);
cas... |
e51d3e75-3191-47ba-b0bd-368cffafa58c | 4 | static void Bin2Dec(){
System.out.println();
System.out.print("Please enter a binary number containing only 0s and 1s: ");
String binary = s.nextLine();
for(int i = 0; i < binary.length(); i++){
if(binary.charAt(i) != '0' && binary.charAt(i) != '1'){
... |
079fa2d9-2f53-4b8d-8d61-f900b62d3826 | 6 | public static void main(String[] args)
{
JFrame frame = new JFrame("Ray Tracer");
CustomPanel panel = new CustomPanel(actualWidth, actualHeight, ANTIALIASING_AMOUNT);
frame.setBounds(0, 0, width, height);
frame.add(panel);
frame.setVisible(true);
frame.setFocusable(true);
... |
0663b957-5de7-4462-aaa7-5e8aeeb45d49 | 5 | private static void updateStringColumn(CyNetwork network, CyIdentifiable cyId,
String columnName, List<CDDHit> hits) {
List<String> dataList = new ArrayList<String>();
for (CDDHit hit: hits) {
if (columnName.equals(CDD_ACCESSION))
dataList.add(hit.getAccession());
e... |
76d07ca0-721d-4808-8226-d6e7706b8e7d | 2 | public void transformCode(BytecodeInfo bytecode) {
this.bc = bytecode;
calcLocalInfo();
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LOCALS) != 0) {
GlobalOptions.err.println("Before Local Optimization: ");
dumpLocals();
}
stripLocals();
distributeLocals();
if ((GlobalOptions.debuggingFl... |
ff09cb1e-187d-4d0c-8761-e4d4d2c76150 | 7 | private void appendRowElements( final RowData rowData,
final Set<CellKey> keys,
final Map<RowElement,CellKey> rowElementKeyMap) {
final List<Object> successors = rowData.getSuccessors();
if ( successors.isEmpty()) { // hat eine RowElement-Komponente
final CellKey cellKey = rowData.getCellKey();
if ( k... |
f26b003c-a047-4286-a0d7-706c9c11456d | 4 | void Rendre() {
// 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;
... |
93d1051a-7b2b-45da-8768-1fc259b073cb | 5 | public void setSanic(){
sanic = true;
if(!sanicd){
try{
BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Sanic.png"));
sprites = new ArrayList<BufferedImage[]>();
for(int i=0; i<4; i++){
BufferedImage[] bi = new BufferedImage[numFrames[i]];
for(int j = 0; j<... |
c2a926e6-053c-4e52-bab7-e280988d8298 | 0 | public void setCallback(Callback callback) {
this.callback = callback;
} |
755e1297-fcbd-4ade-acfa-5051ea10b392 | 8 | public byte[] processBlock(byte[] in, int inOff, int len) throws InvalidCipherTextException {
if (param instanceof BGV11LeveledPublicKeyParameters) {
// Encrypt under input level parameters
BGV11LeveledPublicKeyParameters pk = ((BGV11LeveledPublicKeyParameters) param);
BGV11L... |
304c001f-cd43-4a54-a951-8e34f69c7a8f | 0 | @Override
public Object getInvokeHandler() {
return invokeHandler;
} |
132bec27-0297-4961-9356-0ab502fb6ce8 | 0 | private void affDonneesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_affDonneesActionPerformed
afficherCarte();
}//GEN-LAST:event_affDonneesActionPerformed |
acf2f4b5-85eb-4618-94c9-a6bb8abffebc | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
f23be83a-46a4-4930-bb5e-49a453987acc | 3 | public void sendDate() {
final String[] months = { "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December" };
tblCalendar.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {// must be mouseReleased
int pos =... |
f2db7239-ecbc-4572-8e71-4a6b8a55c66c | 0 | public UserControlParsePane(GrammarEnvironment environment, Grammar grammar) {
super(environment, grammar, null);
intializeGrammarTableSetting();
} |
39a678ff-fcb4-4b33-9b2a-de02201118ce | 1 | public void workWeek() {
for (int i=0; i<5; i++)
{
this.shake();
}
this.earnPaycheck();
this.setEffMult(1);
} |
1a579745-5b3f-4910-98c3-a6153741448b | 8 | public static Keyword continueExistsProof(ControlFrame frame, Keyword lastmove) {
if (lastmove == Logic.KWD_DOWN) {
return (Logic.KWD_MOVE_DOWN);
}
else if (lastmove == Logic.KWD_UP_TRUE) {
{ ControlFrame result = frame.result;
if (result.partialMatchFrame != null) {
result.pa... |
bbf6726b-8e8f-4849-ac50-127bc88793c0 | 3 | @Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, TpURL tpURL, Invocation invocation) {
int weight = 0;
for (Invoker<T> invoker : invokers) {
weight += this.getWeight(invoker, invocation);
}
int factor = random.nextInt(weight);
for (Invoker<T> invoker : invokers) {
weight = weigh... |
4eed8b8f-c321-4db1-b027-6fbec5e2956f | 8 | public void tick() {
// tykniecie arbitera
manager.tick();
// wyluskiwanie widokow srodowiska
RobotEnvironmentView robotEnvironmentView = environment.getRobotEnvironmentView();
StudentEnvironmentView studentEnvironmentView = environment.getStudentEnvironmentView();
// dzialanie na koordynatorach
for (Coo... |
12a9a6d2-eb58-44f9-985d-377d9679cf2b | 4 | public void process(Client sockector) {
Response msg = sockector.getResponseMsgsNotCode().poll();
while(msg != null){
try{
if(sockector.isHandShak()){
broundMsg(sockector,msg);
msg.bufferedContent();// 缓存内容
sockector.getResponseMsgs().add(msg);
}else{
if(!sockector.isClient()){
... |
3852aa45-fa4e-463e-9fc4-2ee2b78eda28 | 8 | public synchronized void controllerUpdate(ControllerEvent event) {
if (Debug.audio) System.out.println("CONTROLLER EVENT");
// If the player has just been realized, then create the control panel.
if (event instanceof RealizeCompleteEvent){
// Now that the player is realized, get the gain controls to allow ... |
e04f535c-b8f8-41f1-8c34-1b2854dc7d49 | 7 | public void fillDNA() {
if (modelID < 0 || proteinID < 0)
return;
ModelCanvas mc = page.getComponentPool().get(modelID);
if (mc == null)
return;
MoleculeCollection c = ((MolecularModel) mc.getMdContainer().getModel()).getMolecules();
if (c.isEmpty() || proteinID >= c.size()) {
setDNA(null);
return... |
1194952c-5ca1-4c60-ace5-f1226f12690b | 4 | public static void main(String[] args) throws IOException
{
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
//TODO Loop for persons, inner loop images of persons
/*List matchedPersons = new ArrayList<Person>();
// person loop
for (Person person : result)
{
// image loop
for (URL url : person.im... |
1b8f93b8-d1c7-4561-8be9-2b42b940cfd6 | 9 | public static void main(String[] args) {
Simulation s = new Simulation();
// Clean up if control-C is pressed
Runtime.getRuntime().addShutdownHook(s.new Cleanup());
if (args.length != 1) {
System.err.println("Usage error: run as <program> <specfile> for a single XML... |
a54a9ef4-c0aa-42af-9f38-f7439b0ae87c | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
ebebfea9-0cb4-4dd0-a4ef-4d3466dea9d3 | 3 | public void reorderList(ListNode head) {
Stack<ListNode> stack = new Stack<ListNode>();
Queue<ListNode> queue = new LinkedList<ListNode>();
ListNode node = head;
int size = 0;
while(node != null){
size++;
stack.add(node);
queue.add(node);
... |
e1409d92-4052-42ea-8a80-4f73aebf40f3 | 4 | public void run() {
// Move all torpedoes and determine if they hit anything
ArrayList<SpaceCraft> destroyed = spaceGameServer.sector.updateTorpedoes();
// Send remove messages for any ships of torpedoes
// that are no longer in the game.
if (destroyed != null ) {
for ( SpaceCraft sc: destroye... |
b77ec017-f215-4136-8ebe-98320ff5197b | 0 | public void setId(int id) {
this.id = id;
} |
b000db17-ab51-4c04-92f1-50c40e11e5c9 | 6 | private Stmt iterationStmt() throws SyntaxException {
Stmt toBeReturned = null;
if (isKind(currentToken, _while)) {
consume();
match(LPAREN);
Expr expr = expr();
match(RPAREN);
match(LBRACE);
ArrayList<Stmt> stmtList = new ArrayList<Stmt>();
// Stmt*. So check for
// FIRST(Stmt) = { ;, IDEN... |
78b32935-7493-459e-9bae-6ca387d5a262 | 6 | private static void loadParameterFile(File file) {
try {
BufferedReader in = new BufferedReader(new FileReader(file));
int count;
for (count = 0; in.ready(); count++) {
String line = in.readLine();
if (line.compareTo("") == 0 || !loadParameter(line)) {
in.close();
loadDefaults();
r... |
8dfdd418-effc-4fb6-a610-feb1e944894d | 3 | private static Map<? extends Attribute, ?> fillattrs(Object... attrs) {
Map<Attribute, Object> a = new HashMap<Attribute, Object>(std.defattrs);
for(int i = 0; i < attrs.length; i += 2)
a.put((Attribute)attrs[i], attrs[i + 1]);
return(a);
} |
617d4a70-d8c6-479d-b7b5-edcd2b5d20d8 | 0 | private String privateMethod()
{
return "private";
} |
72dbb705-371d-4085-986b-adf12796384c | 6 | private static void dropDB(String dbName, String username, String password){
Connection conn = null;
Statement stmt = null;
String dbURL = "jdbc:mysql://localhost";
try{
//STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
//STEP 3: Open a connection
S... |
dd1d6fe8-8356-4c54-9c16-1e2188a6ac45 | 0 | @Override
public boolean isConverted() {
// TODO Auto-generated method stub
return true;
} |
d722a954-7c3d-43cf-beb5-49b6e9a9b532 | 1 | public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
} |
d62e5c20-bcfa-4262-a508-7e405fc55f73 | 3 | public boolean isInsideBounds(int x, int y) {
return x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
} |
9fea0df1-d1d3-41bb-8d94-e9e9322e9b05 | 0 | public void setTotalNumberOfMatches(int totalNumberOfMatches) {this.totalNumberOfMatches = totalNumberOfMatches;} |
50844ba5-ea79-4ced-a674-1a58d178c0d3 | 1 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
ProfesorBean oProfesorBean = new ProfesorBean();
ProfesorParam oProfes... |
f7f0ab9b-2a47-400c-bb2a-546033781b54 | 8 | final public void Variable_declaration() throws ParseException {
/*@bgen(jjtree) Variable_declaration */
SimpleNode jjtn000 = new SimpleNode(JJTVARIABLE_DECLARATION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_con... |
9e6ca376-358e-4fd5-9503-2247adce69ce | 6 | private int sendPacket(Packet packet) throws NotConnectedException, NullPacketException, CouldNotEncodePacketException, PacketIOException {
int sequenceNumber = -1;
synchronized(CONNECTION_LOCK) {
//regardless of whether the packet is valid, if the client is not connected then throw a NotConnectedException
if... |
ab99fa0c-a57a-4b59-84d6-01e1dafd89e9 | 5 | @Override
public boolean editEmployeeSkills(UserSkillSet userSkillSet) {
String userid = userSkillSet.getUserId();
List<SkillRating> updateList = userSkillSet.getSkills();
Connection connection = new DbConnection().getConnection();
PreparedStatement preparedStatement = null;
boolean flag = false;
try {
... |
260243ec-10f3-4f32-96c8-b8e034f4b2fc | 3 | public JMenuItem mkMenuItem(ResourceBundle b, String menu, String name) {
String miLabel;
try { miLabel = b.getString(menu + "." + name + ".label"); }
catch (MissingResourceException e) { miLabel=name; }
String key = null;
try { key = b.getString(menu + "." + name + ".key"); }
catch (MissingResourceExceptio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.