method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b690f015-fe11-4bfb-8dee-812457af7b65 | 8 | private void pivot(int p, int q) {
// everything but row p and column q
for (int i = 0; i <= M; i++)
for (int j = 0; j <= M + N; j++)
if (i != p && j != q) a[i][j] -= a[p][j] * a[i][q] / a[p][q];
// zero out column q
for (int i = 0; i <= M; i++)
... |
2628e7fc-1195-4f67-95d2-61c8b836b4c1 | 4 | public final void update(double dt) {
if (!isTerminated()) {
elapsedTime += dt;
doUpdate(dt);
if (cancelled) {
afterExecutionCancelled();
} else if (isTerminated()) {
afterExecutionCompleted();
getScreen().updateSprites();
if (getFacade().isGameFinished(getWorld())) {
getScreen().game... |
46ca69f7-9c09-4a73-8bd8-7e874a4e6790 | 1 | public InputStream getInputStream(String zipPath) throws IOException
{
Path path = fileSystem.getPath(zipPath);
if(Files.exists(path))
{
return Files.newInputStream(path);
}
return null;
} |
a68b68a9-24a5-472b-8d98-2d4c49f2f8f1 | 7 | static final void method1885(int i, int i_0_, int i_1_, int i_2_, int i_3_,
float[] fs, int i_4_, float f, int i_5_,
int i_6_, float f_7_, float[] fs_8_) {
try {
i_4_ -= i_5_;
i_0_ -= i;
anInt3175++;
i_3_ -= i_6_;
float f_9_ = fs_8_[2] * (float) i_0_ + (fs_8_[1] * (float) i_4_
... |
cda0fd7b-c3df-4a9f-9378-e14ff78e161d | 9 | public static String convert(String fromType, String toType, String num) {
String result = "Error";
int number = 0;
try {
switch (fromType) {
case "-h": // Hexadecimal
number = Integer.parseInt(num, 16);
break;
case "-d": // Decimal
number = Integer.parseInt(num);
break;
case "-o": // ... |
20438de9-05fe-488d-bc7c-80ea66016039 | 1 | public OrderByIterator(Iterable<T> source, Comparator<T> comparator)
{
_list = new ArrayList<T>();
for(T item : source)
{
_list.add(item);
}
this._comparer = comparator;
} |
00f64b29-9186-4244-a703-5566ffe668fc | 5 | private void processQueues() throws SectionMapException {
KeyWeakReference ref;
while ((ref = (KeyWeakReference) refQueue.poll()) != null) {
hashMap.remove(ref.getKey());
}
long expiredTime = System.currentTimeMillis() - 30000;
SectionLink link;
while ((link = sectionQueue.peekFirst()) != null && link.ge... |
102ac130-39c1-4c06-a4a2-0cf0be83d7ce | 2 | public void Action(String destination, String message, boolean autothrow) throws Exception
{
final char actionchar = 0x01;
try
{
Writer.write("PRIVMSG " + destination + " :ACTION" + actionchar + " " + message + " " + actionchar + "\r\n");
Writer.flush();
}
... |
b5ec5806-94ed-4841-9e30-37b7c221c6ea | 2 | public static String fromJulian( long Jd ) // Julian date to string
{
long l = Jd + 68569;
long n = ( 4 * l ) / 146097;
l = l - ( 146097 * n + 3 ) / 4;
long i = ( 4000 * ( l + 1 ) ) / 1461001;
l = l - ( 1461 * i ) / 4 + 31;
long j = ( 80 * l ) / 2447;
int d = (int) (l - ( 2447 * j ) / 80);
l = j / 11;
int m ... |
1f720610-2525-4f85-8a92-dd85adb7bf13 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TSalesman other = (TSalesman) obj;
if (!Objects.equals(this.salesIdScy, other.salesIdScy)) {
... |
f1325840-9ffd-49df-abd7-18fe9cb9ccd0 | 9 | public ChatServer () throws IOException {
server = new Server() {
protected Connection newConnection () {
// By providing our own connection implementation, we can store per
// connection state without a connection ID to state look up.
return new ChatConnection();
}
};
// For consistency, the c... |
cb426a0c-1f9e-4ce8-b799-1a46edb72c6c | 1 | public void onEnable()
{
/* -------------- VARIABLE INITIALIZATION -------------- */
plugin = this;
/* -------------------- LISENERS ----------------------- */
signlisener = new SignLisener(this, log);
/* ------------------- PERMISSIONS --------------------- */
if(this.getServer().getPluginManager().... |
4c61076b-92ad-4b8d-98f3-625b9ea06845 | 2 | private void stepForward() {
// TODO Auto-generated method stub
treePanel.setAnswer(myCurrentAnswerNode);
treePanel.repaint();
if (myCurrentAnswerNode.getDerivation().equals(myTarget))
{
myStepAction.setEnabled(false);
return;
}
ParseNode node=(ParseNode) myQueue.removeFirst();
String deriv=no... |
d0eba4e8-a8e7-4a0b-aa96-61789a5c4d27 | 7 | public void setWinner() throws IOException {
String winner;
if (player1Points > player2Points) {
winner = "1";
} else if (player2Points > player1Points) {
winner = "2";
} else {
winner = "TIE";
}
SocketHandler socketHandler1 = null;
SocketHandler socketHandler2 = null;
iter = clientLists.entr... |
ab1a3ba4-c93b-4798-a73d-dfd96d0dade6 | 0 | @Test
@SuppressWarnings("unchecked")
public void testAbstractFactory() {
ServiceFactory.putService(PersistenceService.class, new PersistenceServiceImpl<BeerEntity>());
PersistenceService<BeerEntity> retrievedService = ServiceFactory.getService(PersistenceService.class);
assertTrue(retrie... |
eaf709c0-55b0-401b-a076-d2b700e6fb23 | 8 | private static void locateLinuxFonts(File file) {
if (!file.exists()) {
System.err.println("Unable to open: " + file.getAbsolutePath());
return;
}
try {
InputStream in = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new In... |
5b57313b-bf26-4b3e-9c22-68df10967bc0 | 3 | public ArrayList<TreeNode> getTips() {
ArrayList<TreeNode> children = new ArrayList<TreeNode>();
Stack<TreeNode> nodes = new Stack<TreeNode>();
nodes.push((TreeNode) this);
while (nodes.isEmpty() == false) {
TreeNode jt = nodes.pop();
for (int i = 0; i < jt.getChildCount(); i++) {
nodes.push(jt.getChi... |
31b20924-db1f-4f01-8a03-7127be2ec7e3 | 9 | private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
EqualsBuilder builder,
boolean useTransients,
String[] excludeFields) {
Field[] fields = clazz.getDeclaredFields();
List excludedFieldList = excludeFields != null ? Arrays.asList(ex... |
40c58b14-3dbf-47ac-bf4b-0a8ed1d954e6 | 4 | public void handleResetButton(){
if(aTimer.isRunning()){
aTimer.stop();
}
aTuringMachine.getInput().clear();
aTuringMachine.getInput().add("Blank Symbol");
simulationView.getPrintError().setText("");
for(int i = 0; i < 31; i++){
if((inputView.getIn... |
04fa541d-73ac-4d15-b88a-cc1fe20533d7 | 8 | private static void cleanup(List<Difference> diffs) {
Difference last = null;
for (int i = 0; i < diffs.size(); i++) {
Difference diff = diffs.get(i);
if (last != null) {
if (diff.getType() == Difference.ADD && last.getType() == Difference.DELETE ||
... |
5d530e30-d639-47af-b842-dfa5aed3a7ba | 4 | public void calculateUptime(String port) {
if (Functions.isNumeric(port)) {
int portValue = Integer.valueOf(port);
Server s = getServer(portValue);
if (s != null) {
if (portValue >= this.min_port && portValue < this.max_port)
sendMessage(cfg_data.irc_channel, s.port + " has been running for " + Func... |
43e21a50-2f4f-475f-9a93-da7a407dbb24 | 7 | public void normalizeSubGoalWeights() {
float sumWeights = 0f;
Iterator<Goal> git = getSubGoalIterator();
while (git!=null && git.hasNext()) {
Goal g = git.next();
sumWeights += g.getWeight();
}
//allow for a small rounding or other error margin before n... |
51d3f515-e4db-443e-98e5-5c3fd37a8df4 | 3 | @Override
public Intersection findBestMove(Board board) {
GameTreeNode root = GameTreeNode.getInstance(board);
GameTree tree = GameTree.getInstance(root);
for(int iteration = 0; iteration < iterations; iteration++) {
if(invariantChecker != null) {
invariantChecker.treeSize(tree.nodes.size());
}
... |
c9a42165-a689-419b-ad85-e9cf0a675088 | 0 | public GetAccountResponse getGetAccountResponse() {
return getAccountResponse;
} |
df73aa0f-fffd-47b1-bf05-6554cd5a13e1 | 7 | public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
float Gross;
System.out.print("Gross Salary: ");
Gross = keyboard.nextFloat();
int Exemptions;
System.out.print("Number of Exemptions: ");
Exemptions = keyboard.nextInt();
float Interest;
System.out.print("Interest... |
27744749-63dc-4f19-9d6f-450f72481148 | 7 | static private double calculatePairwiseDistance(int taxon1, int taxon2) {
double[] total = new double [4];
double[] transversions = new double [4];
for( Pattern pattern : alignment.getPatterns() ) {
State state1 = pattern.getState(taxon1);
State state2 = pattern.getStat... |
3e80058c-25ee-42ba-836e-d5a0edf3e7a0 | 2 | public static void main(String[] args)
{
GraphProperties GP = null;
Graph G = null;
try
{
G = new Graph(new In(args[0]));
GP = new GraphProperties(G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
System.out.println(args[0] + "\n" + G.toString());
for (int v = 0; v <... |
dc2e17c7-e738-486d-a94a-0c11eac3491b | 7 | public void zoneEventOccurred(String eventZone, int eventType) {
if((eventType == ZoneEvents.MOVEMENT || eventType == ZoneEvents.ENTER )&& eventZone.equals("sectionNav")){
if(Debug.gui)
System.out.println(eventZone);
if(triggerShimmyIn());
else if(triggerShimmyOut());
else{
if(Debug.gui)
Sys... |
42943d0f-bc62-4696-b4bd-91f661dfbf24 | 9 | boolean setField(String fieldName, JsonReader reader) throws IOException {
if (fieldName.equals("Name")) {
name = reader.nextString();
} else if (fieldName.equals("X")) {
x = reader.nextInt();
} else if (fieldName.equals("Y")) {
y = reader.nextInt();
} else if (fieldName.equals("LastX"... |
7e1b2bc8-6614-45b0-8a87-3b0b9b6a639a | 8 | public static void main(String[] args) throws java.io.IOException {
if (args.length != 8) {
System.out.println("Usage: Experiment <instance_list> <num_topics> <num_itns> <print_interval> <save_state_interval> <symmetric> <optimize> <output_dir>");
System.exit(1);
}
int index = 0;
String i... |
c1a5e70e-65ea-465a-ba06-3b3ed8d68c64 | 0 | public float getWeight() {
return weight;
} |
2cec0303-f7b7-4c19-8b65-1abd62ed4b0a | 7 | public void update() {
int xa = 0, ya = 0;
if (anim < 7500) {
anim++;
} else {
anim = 0;
}
if(input.up) ya--;
if(input.down) ya++;
if(input.left) xa--;
if(input.right) xa++;
if(xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walking = false;
}
} |
732b9c59-0e08-462d-aee1-979301a97461 | 2 | public static FacilityCategoryEnumeration fromValue(String v) {
for (FacilityCategoryEnumeration c: FacilityCategoryEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
2b48aef8-3865-4360-95c1-5513efb5abfc | 1 | public void setAlias(String alias)
{
alias = alias.trim();
if ( alias.isEmpty() ) {
throw new RuntimeException( "'alias' should not be empty" );
}
this.alias = alias;
} |
4700ef3a-7d06-459d-9c51-b6013904f835 | 0 | public void setSolUsuario(String solUsuario) {
this.solUsuario = solUsuario;
} |
6c3fede5-f6fe-401c-a665-f03bac399d4a | 0 | private static JavaMailSenderImpl getMailSender() throws MessagingException {
String password = "chao123jing";//PropertyManager.getInstance().getDbProperty(PropertyManager.DB_EMAIL_PASSWORD, true);
String username = "52673406@qq.com";//PropertyManager.getInstance().getDbProperty(PropertyManager.DB_EMAIL_USERNAME, t... |
65bff163-ab99-45dc-a5e0-35838084030d | 8 | private void selectOption(int option) {
if (allowClick) {
game.jukeBox.play(game.jukeBox.tracks.buttonClick);
if (option == 0) {
if (Bootstrap.MUTE) {
options[0] = "On";
Bootstrap.MUTE = false;
} else {
options[0] = "Off";
Bootstrap.MUTE = true;
}
Bootstrap.MUTECHANGE = 1;
... |
63a12749-49d1-45db-8101-82f2f7e2b7af | 7 | public void paint(java.awt.Graphics g) {
java.awt.Graphics2D g2d = (java.awt.Graphics2D) g.create();
String text = getText();
java.awt.Dimension size = getSize();
java.awt.Insets ins = getInsets();
java.awt.FontMetrics fm = g2d.getFontMetrics(getFont());
int h = fm.stri... |
0c045591-e7fa-4975-b27f-f662c498d95d | 5 | private void loadAllProjects(){//requires components and QC stuff
try {
ResultSet dbAllProjects = null;
Statement statement;
statement = connection.createStatement();
dbAllProjects = statement.executeQuery( "SELECT Project.projectID, Project.projectName, Project.r... |
1207cc99-1a30-41be-a3c1-50d52b324141 | 8 | public int compareTo(Contact contact) {
if (taxi1 < contact.taxi1) return -1;
if (taxi1 > contact.taxi1) return 1;
if (taxi2 < contact.taxi2) return -1;
if (taxi2 > contact.taxi2) return 1;
if (start < contact.start) return -1;
if (start > contact.start) return 1;
... |
93669480-4d04-41aa-a22e-c84b732385f8 | 4 | private void loadBorrowedBooksTable() {
DefaultTableModel dft = (DefaultTableModel) jTable1.getModel();
dft.setRowCount(0);
try {
ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from borrowedbooks order by BorrowedID ASC");
while (rs.next()) {
... |
9d8854da-971e-48f8-90b5-a8670d5220d5 | 6 | public String[] decompile(int[] data) {
StringBuilder builder = new StringBuilder();
for(int i = 0; i < data.length; i++) {
MCSInstruction cmdInstruction = instructions.get(data[i]);
switch(cmdInstruction.getArgLen()) {
case 0:
builder.append(cmdInstruction.getCommandName()+"\n");
break;
case 1:... |
e6719e21-6289-4d5d-bcc0-112b0b4f880f | 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... |
17813444-a852-4132-8174-3ced09300cd8 | 4 | public void remove_polypoint(int p) {
if (type!=TYPE_POLY || poly.npoints<=3) return;
Polygon pnew = new Polygon();
for (int i=0; i<poly.npoints; i++)
if (i!=p-1)
pnew.addPoint(poly.xpoints[i], poly.ypoints[i]);
poly=pnew;
} |
d96a67d5-0812-42dd-8c03-4ac0debf1e5a | 8 | * @param filename
* @param ifexists
* @param environment
*/
public static void saveModule(Module module, String filename, String ifexists, Environment environment) {
{ boolean existsP = Stella.probeFileP(filename);
if ((!existsP) ||
Stella.stringEqualP(ifexists, "REPLACE")) {
}
... |
6368748f-55d0-4ae6-8052-8867732a3ee6 | 2 | private void addSensorEx2(){
Sensor input = new Sensor();
input.setUnity("s");
input.setAddDate(new Date(System.currentTimeMillis()));
input.setLowBattery(false);
input.setStatementFrequency(1322);
input.setSamplingFrequency(1050);
input.setGpsLocation(-0.12712, 2.07222);
input.setName("Sensor_Graph");
... |
e0bba9a0-3333-4189-9469-8bef3ed8d9de | 1 | private void showChange() {
if (bodyPos.getChildren().contains(hboxChange)) {
return;
}
bodyPos.getChildren().add(1, hboxChange);
} |
b6c67cfb-ddd0-4279-b4e7-1435ff21ceb7 | 0 | private void addStats() {
this.setAgility(this.agility + 10);
this.setDexterity(this.dexterity + 10);
this.setIntelligence(this.intelligence + 10);
this.setStrength(this.strength + 10);
this.setVitality(this.vitality + 10);
this.setLuck(this.luck + 1);
} |
8ddb48fc-20dd-4002-9411-160c4661a0f8 | 9 | private CucaDiagramFileMakerResult createFileInternal(OutputStream os, List<String> dotStrings,
FileFormatOption fileFormatOption) throws IOException, InterruptedException {
if (diagram.getUmlDiagramType() == UmlDiagramType.STATE
|| diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) {
new CucaDiagramSi... |
4f48996c-843a-4bf4-9bf6-b8d4e11cfb29 | 0 | @Override
public void endSetup(Attributes atts) {
super.endSetup(atts);
} |
7c0fc1b7-8cc3-4bbd-bbfe-47e4686a736f | 8 | public ArrayList<Object> scanInput() {
Scanner scanner = new Scanner(System.in);
input = scanner.nextLine();
scanner.close();
if (input.contains("Neuer K-Raum")) {
ArrayList<Object> liste = new ArrayList<Object>();
liste.add("Add");
liste.add(legeKo... |
d1e93be2-0346-4f5b-8477-e43af9eebbfb | 3 | public static void closeStatement(Statement stmt) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException ex) {
LOGGER.trace("关闭JDBC Statement失败", ex);
} catch (Throwable ex) {
// We don't trust the JDBC driver: It might throw
// RuntimeException or Error.
LOGGER.trace("关闭JDBC Sta... |
ef07cad7-a25b-44d7-8688-96a5965aec71 | 2 | public void replace_field_from_memory( int i )
{
if(isReadOnly()) return;
try { fdbf.seek( recordpos() + Field[i].fpos ); } catch (IOException e) {}
replacefielddata(i);
update_key();
getfieldsValues();
} |
c621f93f-658f-41f2-a61b-a46e1e556012 | 1 | public String getClassInfo(int index) {
ClassInfo c = (ClassInfo)getItem(index);
if (c == null)
return null;
else
return Descriptor.toJavaName(getUtf8Info(c.name));
} |
d6aeab08-87c3-4a9b-8640-47b125231339 | 5 | public void testSaveOsobu() {
Osoba o=new Osoba();
o.setImePrezime("Alen Kopic");
Date datumRodjenja=new Date(1992,10,21);
o.setDatumRodjenja(datumRodjenja);
o.setAdresa("Vitkovac 166");
DBManager.saveOsobu(o);
List<Osoba>osobe=DBManager.dajOsobe();
Boolean tacno=false;
for... |
91605091-a065-4d2a-ab9d-7f59b25e0bc8 | 5 | private void setupGui() {
setTitle("Update Available!");
setModal(true);
setSize(451, 87);
setResizable(false);
setUndecorated(true);
close.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
... |
8be71d53-da16-4894-9169-24aac52e2b62 | 4 | void constructDefLab(){
defLab = new int[DIM*DIM][4];
for (int i=0;i<DIM*DIM;i++){
defLab[i][NORD] = -1;
defLab[i][SUD] = -1;
defLab[i][EST] = -1;
defLab[i][OUEST] = -1;
}
for (int i=0;i<ouvertures.size();i++){
if (ouvertures.get(i).s2.num-ouvertures.get(i).s1.num==1){
defLab[ouvertures.get... |
e834168a-e910-48f5-aeda-2f0db93fcf74 | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
cf8d7240-2e30-4a8b-963e-461d8059d447 | 3 | public Event(HashMap<String, String> hint) throws IllegalArgumentException {
final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// Must throw errors if this is not an expected date format
formatter.setLenient(false);
this.eventName = hint.get("eventName");
this.venueId = hint.g... |
91632bd2-afb5-4f94-b44e-62e7ecfa52d5 | 2 | @Override
public Long validate(String fieldName, String value) throws ValidationException {
if (value == null) {
return null;
}
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
throw new ValidationException(fieldName, value, "not a valid long", e);
}
} |
e8b3bf97-4957-4b76-b04f-19dab1652be2 | 2 | public void singleOut(StringBuilder sb1, StringBuilder sb2)
throws IOException {
tableWrite(Prop.single_Head, sb1, sb2); // レコードはあるのでテーブルを書く
/* レコード出力 */
for (int i = 0; i < record[1][0].length; i++) {
sb2.append("<tr><td class=\"genre\">")
.append(record[1][2][i])
.append("</td><td class=\"year\"... |
deec44d0-3183-40d2-9649-0c39efb99266 | 8 | public void parse() {
parseIndex = 0;
//Split into words
parsingWords = originalString.split(" ");
//The first word is the first word
boolean firstWordInSentence = true;
//A flag for the ending word in a sentence
boolean endingWord = false;
//Currently bui... |
aa53692d-18f6-4698-b32e-1af919634676 | 1 | static void gameloop() {
int i = 1;
do {
round(i);
i++;
} while (askContinue());
} |
9fb37c72-4873-4c4e-8f15-49a26d59b07d | 6 | public Song getLightSong(Song currentSong, String userId) {
Song lightSong = new Song(currentSong.getSongId(),
currentSong.getTitle(), currentSong.getArtist(),
currentSong.getAlbum(),currentSong.getOwnerId(), currentSong.getTags(),
currentSong.getRightsByCategory... |
cb2f3613-fafd-49f0-925c-9c7581ec4cba | 5 | protected boolean isThisKey(String str) {
boolean result = false;
if (str != null) {
int eqIndex = str.indexOf("=");
result = (str.startsWith("-") && str.substring(1, 2).equals(shortKey()))
|| (str.startsWith("--") && str.substring(2, eqIndex == -1?str.length():eqIndex).equals(fullKey()))... |
a5a06c57-9428-4309-b8ab-232741a32c71 | 1 | public byte getByte(Object key) {
Number n = get(key);
if (n == null) {
return (byte) 0;
}
return n.byteValue();
} |
cbc89e8e-158e-41c8-8802-fe9413c8be78 | 9 | @Override
public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) {
logger.info(round + " "+ planes.get(1).getLocation());
for(int i = 0; i < planes.size(); i++) {
if (planes.get(i).getLocation().distance(planes.get(i).getDestination())<=2) {
} else if(dynamicPlanes.contains(i) &&... |
5c2a8252-05df-41da-8243-8f3759e9b0f3 | 3 | public void tick() {
if (LAND.size()<maxSize) {
population+=1+population*owner.growthRate/100;
if (population>LAND.size()*owner.populationDensity) {
expand();
}
}
if (population>maxPopulation)
population=maxPopulation;
} |
d78cbec4-3566-4f6e-afff-8eb800025d29 | 8 | public ClassRegistry(String s, String as[], String s1)
{
super(as.length);
version = s;
classesToRegister = as;
baseClassName = s1;
Class class1 = null;
try
{
class1 = Class.forName(s1);
}
catch(ClassNotFoundException classnotfounde... |
a498a417-3eaa-4ef7-91f2-cf4966d6a860 | 0 | public void go()
{
frame = new Frame("Complex Layout !");
b1 = new Button("b1");
b2 = new Button("b2");
frame.add(b1,BorderLayout.WEST);
frame.add(b2,BorderLayout.CENTER);
panel = new Panel(); //默认为FlowLayout
b3 = new Button("b3");
b4 = new Button("b4");
panel.add(b3);
panel.add(b4)... |
170741d7-c68a-49ca-a7f5-bd9ed2076e5b | 4 | public static List<String> expandWithThesaurus(String node)
throws JSONException {
List<String> resultsList = new ArrayList<String>();
List<String> expandedNodes = new ArrayList<String>();
List<String> expandedTerms = new ArrayList<String>();
List<String> narrower = searchNarrower(node);
List<String> toExp... |
fbb5419d-700e-4aa0-a0a8-642c0d544548 | 8 | @EventHandler
public void onPluginMessage(PluginMessageEvent event){
if (event.getTag().equals("BTProxy") && event.getSender() instanceof Server) {
ByteArrayInputStream stream = new ByteArrayInputStream(event.getData());
DataInputStream input = new DataInputStream(stream);
// Important message debugging (c... |
480ff27a-801e-4b55-a201-5f131e950b0f | 2 | public void printList() {
System.out.println("print adjacency list size here : " + Canvas.coordListSize);
for (int i=0; i<Canvas.coordListSize; i++) {
System.out.print(i + " ");
for (int j=0; j<adj[i].size(); j++) {
System.out.print(adj[i].get(j) + " ");
... |
815b68a5-258d-4451-a172-9eecd50cfe86 | 0 | public int compareTo(Card card) {
return (convertRank() - card.convertRank());
} |
f523465a-775d-4e9f-ab21-fab8ee490c19 | 5 | public static TableModel fromCSP(CSProperties p, final int dim) {
List<String> dims = keysByMeta(p, "role", "dimension");
if (dims.isEmpty()) {
return null;
}
for (String d : dims) {
if (Integer.parseInt(p.get(d).toString()) == dim) {
final List<St... |
9fc62c85-53fd-495d-bc77-4b05c8026325 | 6 | @RequestMapping(value = "/save", method = RequestMethod.POST)
public ModelAndView save(@ModelAttribute("teamForm") Teams teamForm) {
List<Team> userInfo = teamForm.getTeamsInfo();
String playerInfo;
String userEnteredPlayerName = null;
int startIndex = 0, endIndex = 0;
List<playerUserInformation> playerInfo... |
efdf7c6b-1bc2-440c-971c-d29d5ff00ff1 | 2 | public static void main(String[] args) {
char again;
int n;
double determinant;
do{
print("Enter the dimension of the matrix: ");
n = scan.nextInt();
double[][] matrix = new double[n][n];
print("\nEnter the matrix data:\n");
input(matrix);
determinant = det(matrix);
print("\nThe determinant... |
a7768c31-578c-4010-bc3d-915dc7ecc96a | 8 | private boolean jj_3R_368() {
if (jj_scan_token(LB)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_460()) {
jj_scanpos = xsp;
if (jj_3R_461()) {
jj_scanpos = xsp;
if (jj_3R_462()) {
jj_scanpos = xsp;
if (jj_3R_463()) return true;
}
}
}
while (true) {
x... |
59043ec6-88c3-4b51-b43b-0f371436de18 | 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 fe... |
1660fb6e-99c1-419d-903c-6c48a5f323dc | 8 | @Override
public void run() {
try {
InputStream input = clientSocket.getInputStream();
OutputStream output = clientSocket.getOutputStream();
byte[] requestData = new byte[8192];
for (int i = 0; i < 8192; i++) {
int inByte = input.read();
if (inByte == 10) { // LF (ASCII = 10) signifies end of... |
de834e64-57c3-4f20-9ddd-74bcff307794 | 2 | public byte[] getRange(int from,int to) {
if((from < 0)||(to > this.index))
throw new IndexOutOfBoundsException("AutoAllocatingByteBuffer.get() called for invalid buffer range");
return Arrays.copyOfRange(buf, from, to);
} |
c2489d79-ddd9-4d04-8d7f-62a86cc69345 | 5 | @SuppressWarnings({ "unchecked", "unused" })
@ApiMethod(name = "listMessages")
public CollectionResponse<MessageData> listMessages(
@Nullable @Named("cursor") String cursorString,
@Nullable @Named("limit") Integer limit) {
EntityManager mgr = null;
Cursor cursor = null;
List<MessageData> ... |
169e1113-b79e-474a-bd3a-3d7ddfdfd896 | 7 | public static void connecJambtoDoor(CABot3Net objRec){
int jambOffset = 2;
int doorOffset = 3;
int netSize =objRec.getInputSize();
int cols = objRec.getCols();
int row;
int toRow;
int jambIndex;
int doorIndex;
double weight = 0.9;
for(int neuron=0; neuron<netSize; neuron++){
... |
4345a384-f7cc-48d5-9498-37107aa6c032 | 0 | public CtrlPraticiens getCtrl() {
return ctrlP;
} |
ebd134d9-413a-4504-b13e-66cfe8bd5288 | 6 | public PrimitiveStructure getPrimitiveChild( boolean strict ) {
if( strict && getChildren().isEmpty() ) {
throw new RuntimeException(getType() + " float data not specified.");
}
if( strict && getChildren().size() > 1 ) {
throw new RuntimeException(getType() + " has t... |
b966c274-a6c8-4e72-8ce0-baa51847aa91 | 4 | public void actualiza() {
//Determina el tiempo que ha transcurrido desde que el Applet inicio su ejecución
long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual;
//Guarda el tiempo actual
tiempoActual += tiempoTranscurrido;
if (canasta.getMoveLeft()) {
... |
54c165c1-f0aa-4e0a-a870-338504b45201 | 5 | public int getColumnIndex(String columnVariableName){
for(Class<?> c=classOfData; c!=null ; c=c.getSuperclass()) {
for(Field f : c.getDeclaredFields()) {
f.setAccessible(true);
Column column = f.getAnnotation(Column.class);
if(column!=null && f.getNam... |
77ee1aad-6d7a-42d9-9049-2563c6648898 | 7 | public void gatherData() {
data = new HashMap<UnitType, Map<Location, Integer>>();
unitCount = new TypeCountMap<UnitType>();
for (Unit unit : getMyPlayer().getUnits()) {
UnitType type = unit.getType();
unitCount.incrementCount(type, 1);
Map<Location, Integer... |
77b23aa3-b6a1-4998-8999-7f921a858d3a | 9 | public void paramFileProcess(){
try {
BufferedReader stream = getFileToRead(fileSet.getParamFile().toString());
String line;
while((line = stream.readLine())!=null){//reading everything line by line
char[] charLine = line.toCharArray();
for(int i =0;i<charLine.length;i++){
if(charLine[i]=='#' ... |
c939d283-b307-4301-b1c8-d9b0c27e95ae | 1 | private void compute_new_v()
{
// p is fully initialized from x1
//float[] p = _p;
// pp is fully initialized from p
//float[] pp = _pp;
//float[] new_v = _new_v;
//float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
//float[] p = new float[16];
//float... |
85d0d5a4-4f99-44e7-aee6-89c81e36bfff | 4 | List<Integer> getRow1(int rowIndex) {
List<Integer> res = new ArrayList<>();
if(rowIndex<=0){
res.add(1);
return res;
}
Integer[] arr = new Integer[rowIndex+1];
int i, j;
for(i=1, arr[0]=1; i<=rowIndex;++i) {
if(arr[i]==null){
arr[i] = 0;
}
for (j = i; j > 0; --j) {
System.out.println... |
e28ea7c4-171a-4ad4-b6a2-102e67758a55 | 0 | private void printTime(double time) {
System.out.println("Average time taken: " + time + " ms");
} |
2b791c73-59e0-4d80-a4dd-8bb6451b4998 | 1 | @Override
public Position<T> root() throws EmptyTreeException {
if (root == null)
throw new EmptyTreeException("Empty tree");
return root;
} |
5d671792-b4f9-4045-a866-7ad39e49e27b | 0 | public Query<T> take(int count)
{
return new Query<T>(new TakeIterable(this._source, count));
} |
f2470f18-2f85-4b6d-8251-e969ad6ad810 | 1 | public ErrorHandler getErrorHandler() {
if(errorHandler==null)
errorHandler = createErrorHandler();
return errorHandler;
} |
bbd8438e-f634-460d-9fdc-bd2b88802813 | 6 | public List<GrupoDTO> getAllGrupos(String semestre){
List<GrupoDTO> grupos = new ArrayList<GrupoDTO>();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = EscolarConnectionFactory
.getInstance().getConnection();
String sql = "select id_grupo, clave, descripcion ... |
0464754b-9712-4f77-aedb-6818c9968280 | 8 | public static boolean isSatisfied(int[][] grid, int i, int j, int threshold)
{
int solidarity = 0;
//Sets Upper and Lower Bounds for the area around our given point
int iLB = i - 1;
int iUB = i + 1;
int jLB = j - 1;
int jUB = j + 1;
//Account... |
6543afaf-7621-44c7-8e52-995b7e3b49e4 | 3 | public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.shovel) {
if (player.payStamina(4 - tool.level)) {
level.setTile(xt, yt, Tile.dirt, 0);
return true;
}
}... |
4a86b2b4-95db-49f6-84aa-9008b7e4aa1a | 4 | @Override
public void actionPerformed(ActionEvent e) {
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard()
.getContents(null);
String text = new String();
if ((t != null) && (t.isDataFlavorSupported(DataFlavor.stringFlavor))) {
try {
text = (String) t.getTransferData(DataFlavor.stringFla... |
82651eed-2fe7-4ed5-93d0-33667008402e | 5 | public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
int button;
button = keyboard.nextInt();
switch(button){
case 1: System.out.println("cola is served");
break;
case 2: System.out.println("lemonade is served"+',');
break;
case 3: System.out.println("water is serv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.