method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e1567546-3120-46f1-8ee1-b113ad23e2ac | 8 | @Override
public Object getValueAt(int row, int column)
{
PeerStatEntry e = data.get(row);
switch(column)
{
case 0:
return e.ip;
case 1:
return e.path;
case 2:
return e.state;
case 3:
return formatByteCount(e.bytesIn);
... |
312f0ed7-d0cd-4f5d-953f-59b8831ad2d8 | 0 | public String goToAdminOrdersList() {
this.retrieveAllOrders();
return "adminOrdersList";
} |
b271f892-3478-4d9d-b505-c80b9474af30 | 7 | public String nextString() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
String result;
if (p == PEEKED_UNQUOTED) {
result = nextUnquotedValue();
} else if (p == PEEKED_SINGLE_QUOTED) {
result = nextQuotedValue('\'');
} else if (p == PEEKED_DO... |
f96431da-101c-40b5-bdba-c52665eb730e | 4 | public char getNextChar() {
try {
//Leemos un caracter y seteamos a nuestra variable currentChar de objeto
setCurrentChar((char) pr.read());
//Sumamos 1 al caracter en la línea
setNumeroDeCaracterEnLinea(getNumeroDeCaracterEnLinea()+1);
... |
76d1a716-6c9d-420a-98b4-7a8ebeb66819 | 7 | private void YearBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_YearBoxActionPerformed
int m = MonthBox.getSelectedIndex() + 1;
int y = YearBox.getSelectedIndex() + (Calendar.getInstance().get(Calendar.YEAR) - CountYears);
int n = m != 2 ? m > 7 ? 30... |
841e8885-04e8-4846-9488-065151861a5d | 5 | @Override
public Calisan getCalisan(HashMap<String, String> values) {
try {
String ad = values.get("ad");
String soyad = values.get("soyad");
String telefon = values.get("telefon");
String resimURL = values.get("resimURL");
String kullaniciAdi = va... |
81822327-a33a-4140-8855-a7b177e04e0a | 4 | @Override
public SpellCheckResult check(String word) {
for (int j = 0; j < wordsInDictionary.length; j++) {
if (word.compareTo(wordsInDictionary[j]) == 0) {
return new SpellCheckResult();
} else if (word.compareTo(wordsInDictionary[j]) < 0) {
if (j == ... |
ce159b83-15a7-4872-a617-e1ffd8d18eb6 | 9 | public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
if (splitted[0].equalsIgnoreCase("-1")) {
String playerName = splitted[1];
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps;
int done = 0;
... |
70f3ced9-d37b-44b5-81eb-f84ef54f81ad | 2 | private static void handleSendOfferExceeded(SerializableOfferExceeded pack) {
List<String> sellers = pack.commandInfo;
SelectionKey key;
// reset list in pack (no longer needed)
pack.commandInfo = null;
// send "offer exceeded" packet to each seller still logged in
for (String seller : sellers) {
key... |
6fabc264-13ab-4023-91ad-d424f6336bef | 4 | void passf3(int ido, int l1, final double cc[], double ch[], final double wtable[], int offset, int isign)
{
final double taur=-0.5;
final double taui=0.866025403784439;
int i, k, ac, ah;
double ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
int iw1, iw2;
... |
0a1a86e5-097b-4e9c-9f33-76e40bed41b9 | 5 | private void raiseAlarm()
{
if (TimerPreferences.getInstance().getBoolean("mute", false))
{
System.out.println("Beeping");
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
... |
d52f61b8-f206-4919-b593-88fca2833bcb | 7 | @PUT
@Path("/{idres}")
@Consumes(MediaType.LIBROS_API_RESENA)
@Produces(MediaType.LIBROS_API_RESENA)
public Resena updateResena(@PathParam("idres") String idres, Resena resena, @PathParam("idlibro") String idlibro) {
String username;
Connection conn = null;
Statement stmt = null;
String sql;
ResultSet rs... |
50cf5ccc-b5e1-485e-b7d1-d921be47976d | 7 | public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
int valid = 0;
double sum = 0;
for(;;){
if(valid == 2){
System.out.println("novo calculo (1-sim 2-nao)");
double input = s... |
4b7de367-93d1-4f28-8821-ca8538a6c424 | 8 | public final ExecResults executeImpl(ExecCommands newCommands) {
validateCommands(newCommands);
if (!isExecFinishedAndDisabled) {
// from robot to battle
commands.set(new ExecCommands(newCommands, true));
print(newCommands.getOutputText());
} else {
// slow down spammer
try {
Thread.sleep(100)... |
3d7344e5-dac6-4815-b8d5-1cb467648bd4 | 5 | public void startServer() {
if (!isStarted) {
isStarted = true;
try {
AddressProvider.host();
} catch (IOException ex) {
System.err.println("SERVER: Could not connect to swe.no. Only LAN connections possible.");
}
try ... |
18ca6dd3-5382-488e-844f-a0fb94b15470 | 1 | public void cerrarSocket() {
try {
socketConServidor.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
1a369fc7-fbfb-477c-ba81-342803ccc352 | 6 | private boolean saveToFile(String filePath) {
try {
FileOutputStream saveFile = new FileOutputStream(filePath);
ObjectOutputStream oos = new ObjectOutputStream(saveFile);
// BufferedOutputStream save = new BufferedOutputStream(oos);
oos.writeObject(bg.getPath());
... |
4c13125f-b578-41cc-bd65-32e8ff6735ad | 3 | protected GenericConverter getDefaultConverter(Class<?> sourceType, Class<?> targetType) {
return (targetType.isAssignableFrom(sourceType) ? NO_OP_CONVERTER : null);
} |
4b5bd896-2539-483f-858f-804afca43c7d | 8 | @Override
public void initResources() {
initialScreen = true;
bossLoaded = false;
myBarrierGroup = new SpriteGroup("barrier");
myPlayerGroup = new SpriteGroup("player");
myEnemyGroup = new SpriteGroup("enemy");
myProjectileGroup = new SpriteGroup("projectile");
myEnemyProjectileGroup = new SpriteGroup("... |
82a8ecaa-61e3-462b-a60a-6c15caa51377 | 2 | public boolean insertaUsuario(String login, String pass, String nombre, String categoria) {
boolean res = false;
Statement statement;
ResultSet resultSet;
try {
Connection con = DriverManager.getConnection(connectString, user, password);
statement = con.createSta... |
2ebe8e73-2be9-4f72-a596-775b8e329b77 | 5 | void calculateInfluences(DetailedMovie detailedMovie, ArrayList<DetailedMovie> detailedMovieInfByList, ArrayList<DetailedMovie> detailedMovieInfList)
{
try
{
queryUtility.calculateInfluences(detailedMovie, detailedMovieInfByList, detailedMovieInfList);
}
catch (QueryEva... |
86b5e939-326e-44e9-acf6-58241c8389e5 | 1 | @Override
public boolean equals(Object obj) {
if (obj instanceof Cell) {
return isAlive == ((Cell) obj).isAlive();
} else {
return false;
}
} |
fa2dd134-c29c-4363-a70c-c895e25bab16 | 9 | public List<Motorcycle> getAllMotorcycles()
{
List<Motorcycle> Motorcycles = new ArrayList<Motorcycle>();
try
{
ResultSet rs = getMotorcycleStmt.executeQuery();
while (rs.next())
{
Brand brand = null;
if (rs.getString("brand").equals("Honda"))
brand = Brand.Honda;
if (rs.getString("b... |
11d139e1-3f65-4c08-bc24-1210c858f091 | 2 | boolean setSpeed(int speed) {
if (speed < 0 || speed > 16)
return false;
this.speed = speed;
return true;
} |
eac80567-901d-46da-b2ef-81d9c147af82 | 6 | @Override
public void startUp() {
if (waitingGameScreen == null) {
logger.error(new NullPointerException(),
Helpers.concat("Tried starting game without there being default game screen given.",
"Make sure to set it with setCurrentGameScreen(GameScreen gameScreen)"));
Runtime.getRuntime().exit(0xDEAD... |
e998841c-ac86-4142-9785-4a315174e0ed | 6 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
jDialog1 = new javax.swing.JDialog();
... |
a0733170-aee4-4f4f-bd10-411bc33cd601 | 9 | @Override
protected Expression unary() throws ParsingException {
Expression result;
if (tokens[position].equals(Lexeme.NOT.s)) {
position++;
result = new Not(unary());
return result;
}
if (tokens[position].equals(Lexeme.FOR_ALL.s)) {
po... |
11d273bd-7704-4935-a96d-fa623556e02e | 6 | public void verticalFill()
{
int assignTileInt = 0;
switch (tileSet)
{
case INDOORS:
assignTileInt = assignTileIntIndoors;
break;
case OUTDOORS:
assignTileInt = assignTileIntOutdoors;
break;
}
int tileNum = currentArea[location.x][location.y];
for (int y = location.y; y<=getAreaHeigh... |
0bbdbf34-6470-4a65-91d9-ad2c0dbd4418 | 4 | public synchronized void unregister(Cancelable current) {
TreeNode currentNode = findNodeInTaskTrees(current);
if (currentNode instanceof TreeNode) {
List currentChildren = currentNode.getChildren();
TreeNode currentParent = currentNode.getParent();
for (Iterator iter = currentChildren.ite... |
2e4771f3-1bb5-4981-b017-ab3a999fde4b | 7 | private void output(String outputDir) {
File file = new File(outputDir + File.separatorChar + "objectsInAllDumps.md");
if (!file.getParentFile().exists())
file.getParentFile().mkdirs();
try {
PrintWriter writer = new PrintWriter(new FileWriter(file));
writer.println("## Heap Dump");
... |
67c57d6f-4038-4d5a-a2ec-eef0fca61f0b | 9 | private static posCounter errorPosition(String mm){
int i = 0; //iterator for loop
int pi = 0; //positions index number
int in = 0; //boolean for values inside pre array
int con = 0;//holder for converted atoi values
int pri = 0;//iterator for previous digit ... |
1dcae9eb-9a6b-474f-aefa-4a23a25f6550 | 4 | private void ProcurarEquipa_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ProcurarEquipa_ButtonActionPerformed
try {
Equipa equipa = a.getEquipa(Escola_ComboBox1.getSelectedItem().toString(), Escola_ComboBox1.getSelectedItem().toString() + "-" + Equipa_ComboBox2.getSelecte... |
118159e4-701b-4c4c-9557-74466a534c42 | 4 | static void setup(CommandLine line) throws NumberFormatException {
if (line.hasOption("array_id")) {
parameterNumber = Long.parseLong(line.getOptionValue("array_id"));
}
if (line.hasOption("database")) {
databaseStem = line.getOptionValue("database");
}
if... |
5bd695fc-fb3d-4439-83ab-d0072ce59549 | 8 | public void changeState(){
deltaTime = 0;
state = state.next();
//state.print();
switch (state) {
case KKMMM:
US.setLamps(true, true, false);
Barat.setLamps(true, false, false);
Timur.setLamps(true, false, false);
TU.setLamp(true);
stateTime = Main.time[0];
break;
case HHMMM:
US.setLamp... |
08897ead-6377-4497-b248-77becb39a26c | 8 | public HttpResponse makeResponse(HttpRequest request, String rootDirectory, File file) {
// Handling PUT request here
boolean preexists = false;
if (file.exists()) {
preexists = true;
}
HttpResponse response = null;
if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
BufferedWr... |
6a3fb67e-7f04-468f-be11-c098eb507a10 | 0 | public void setDirty() {
// EDebug.print("Change has come");
dirty = true;
} |
4e9b1f28-1924-4108-9f5c-f6085ac242a8 | 6 | @Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = IntCache.getIntCache(par3 * par4);
for (in... |
ac8dea9b-ad98-4962-89e1-bc302c5ac665 | 0 | public void setCode_lab(String code_lab) {
this.code_lab = code_lab;
} |
0b755928-c14b-49dd-bfdb-7da89d8effe5 | 3 | private void fillInElementsOnProjectList(int projectID){
listOfElements.clear();
if (projectID >=1){
try{
ResultSet elementsOnProjectListResultSet = null;
Statement statement;
statement = connection.createStatement();
elementsOn... |
de5bbe06-5d59-4c7d-a82c-6bc9ccb7bdf8 | 8 | private boolean checkJpeg() throws IOException {
byte[] data = new byte[6];
while (true) {
if (read(data, 0, 4) != 4) {
return false;
}
int marker = getShortBigEndian(data, 0);
int size = getShortBigEndian(data, 2);
if ((marker & 0xff00) != 0xff00) {
return false; // not a valid marker
}
... |
b30d4f03-cff3-466a-b7f3-208657d8e7b2 | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
Answer[] testans = new Answer[4];
int i = 0;
while (i <= 3)
{
testans[i] = new Answer("aa", false);
i++;
... |
34bf64da-c743-41cc-820a-6ba2374e022d | 3 | @Override
public void updateIcon() {
if(isProperty()) {
if (isPropertyInherited()) {
setIcon(ICON_IS_PROPERTY_INHERITED);
} else {
setIcon(ICON_IS_PROPERTY);
}
} else {
if (isPropertyInherited()) {
setIcon(ICON_IS_NOT_PROPERTY_INHERITED);
} else {
setIcon(ICON_IS_NOT_PROPERTY);
}
... |
47c3496c-ed7f-44d1-9f34-0ea263752d4a | 4 | public static void main(String[] args){
Settings settings = new Settings();
File propFile =settings.getPropertiesFile();
boolean outcome = true;
if(propFile.exists()&&propFile.isFile()){
try{
propFile.delete();
} catch (Exception e){
Sy... |
a7d53d88-a5c8-4c10-9548-3030595f722b | 6 | public RdbToRdf(String dir) throws ClassNotFoundException {
if (!dir.endsWith("/")) {
dir = dir + "/";
}
File f = new File(dir);
if (!f.isDirectory()) {
f.mkdir();
}
dir = dir + "TDB/";
f = new File(dir);
if (f.isDirectory()) {
if (f.exists()) {
String[] m... |
6f88e2fe-d38d-4a59-abc3-ad8b2217ca89 | 6 | @Override
public void validate() {
session = ActionContext.getContext().getSession();
User u1 = (User) session.get("User");
Criteria ucri = getMyDao().getDbsession().createCriteria(User.class);
ucri.add(Restrictions.eq("emailId", u1.getEmailId()));
ucri.add(Restrictions.eq("p... |
a3646750-158e-4900-8459-a6defed5f2dd | 0 | public static void main(String[] args) {
System.out.println(2147483647);
System.out.println(-2147483648);
System.out.println(9223372036854775807L);
System.out.println(-9223372036854775808L);
} |
edf1a3d0-b2f1-4216-aa33-0271bd99e2ad | 9 | @Override
protected Integer val00(Integer val) {
if(val<10) return 1;
if(val<20) return 2;
if(val<30) return 3;
if(val<40) return 4;
if(val<50) return 5;
if(val<60) return 6;
if(val<70) return 7;
if(val<80) return 8;
if(val<90) return 9;
return 10;
} |
3f84a133-a3ef-49d9-8cc0-5f0bfa8cd3b8 | 1 | @Test
public void populationRightSize(){
System.out.println(pop.getIndividuals().size());
while(pop.getNumberOfGenerations() < NUM_GEN){
pop.newGeneration();
assertEquals("population size", POP_SIZE, pop.getIndividuals().size());
}
} |
2d89a7e3-8d8d-46f8-b9bf-7a16106075c1 | 0 | public boolean isExpired()
{
return timeout<(System.currentTimeMillis()/1000L);
} |
38f7f85d-1ef0-4075-abb8-07ca88f87cb8 | 5 | public static String GetRegionInformation(String Region) {
String regionString = null;
Document doc;
File Xml = new File("Regions.xml");
try {
if (!Xml.exists()) {
System.out.println("- Extracting Region.xml...");
InputStream is = Tools.class.getClass().getResourceAsStream(... |
fd521b9a-887a-478f-a8dc-aaa58bc7fa9f | 0 | public int getRepeat() {
return repeat;
} |
74eaba77-6e40-46a0-ae61-db53e99437b6 | 0 | protected final void setAuthor(String author) {
this.author = author;
} |
fa429eef-0bef-4e81-ba7a-e1941b2b0b12 | 2 | public static void setWebRootPath(String webRootPath) {
if (webRootPath == null) {
return;
}
if (webRootPath.endsWith(File.separator)) {
webRootPath = webRootPath.substring(0, webRootPath.length() - 1);
}
PathKit.webRootPath = webRootPath;
} |
012d8c25-a683-4fdf-8360-5da526bc8fa3 | 5 | private Image unmarshalImage(Node t, String baseDir) throws IOException
{
Image img = null;
String source = getAttributeValue(t, "source");
if (source != null) {
if (checkRoot(source)) {
source = makeUrl(source);
} else {
source = mak... |
6441a4f5-5c34-43b7-8b7c-8f8d6a1c2cfa | 3 | protected static OutputStream getStream(File file, int flags) throws IOException
{
OutputStream output = new FileOutputStream(file);
if ((flags & NBTSerializer.BUFFERED) != 0)
{
output = new BufferedOutputStream(output);
}
if ((flags & NBTSerializer.COMPRESSED) != 0)
{
output = new GZIPOutputStream(o... |
63bcfe3f-b7cb-4a9c-a39f-e1159803b077 | 9 | public void run() {
try {
boolean running = true;
while (running) {
try {
String line = null;
while ((line = _breader.readLine()) != null) {
try {
_bot.handleLine(line);
... |
a9562b34-91f9-48d3-b7ad-09531e2aae50 | 7 | public void draw(Graphics g) {
int i, p;
for (i = 0; i != 2; i++) {
setVoltageColor(g, volts[nCoil1 + i]);
drawThickLine(g, coilLeads[i], coilPosts[i]);
}
int x = ((flags & FLAG_SWAP_COIL) != 0) ? 1 : 0;
drawCoil(g, dsign * 6, coilLeads[x], coilLeads[1 - x... |
058ee705-448f-4159-bc4d-e02df1369e27 | 4 | public void keyPressed(KeyEvent w) {
int code = w.getKeyCode();
if (code == KeyEvent.VK_A) {
i=0;
dx = -SPEED;
} else if (code == KeyEvent.VK_D) {
i=1;
dx = SPEED;
} else if (code == KeyEvent.VK_W) {
dy = -SPEED;
} else ... |
52970348-a8d3-497e-8b14-d326f780faef | 0 | public boolean equals(char c) {
return this.id == c;
} |
64cdf0e2-5954-4034-97bb-273eec73a380 | 5 | public static float convertSpeedUnitIndexToFactor(int index) {
switch (index) {
case 0:
return KPH;
case 1:
return MPH;
case 2:
return MPS;
case 3:
return KN;
case 4:
retu... |
92231099-552e-4804-9fda-5dcea60feef5 | 1 | public void addPatient(Patient2 newPatient) {
if (this.isLast) {
Patient2 first = nextPatient;
nextPatient = newPatient;
nextPatient.isFirst = false;
nextPatient.nextPatient = first;
this.isLast = false;
} else {
nextPatient.addPati... |
df1b8a52-0107-4a7c-a9c9-81d0253ea0e1 | 3 | public void paint(Graphics g) {
//Background
g.setColor(Color.black);
g.fillRect(0, 0, Run.window.getWidth(), Run.window.getHeight());
//
//Title
g.setFont(titleFont);
g.setColor(Color.white);
g.drawString(Run.TITLE, 50, 50);
//
//Buttons
g.setFont(buttonFont);
if (!hoveringStart) {
... |
b4867902-4f36-4f01-a279-18808fbfd2d2 | 2 | public AcyclicSP(EdgeWeightedDigraph G, int s)
{
distTo = new double[G.V()];
for (int i = 0; i < G.V(); i++)
distTo[i] = Double.POSITIVE_INFINITY;
distTo[s] = 0;
edgeTo = new WeightedDirectedEdge[G.V()];
Topological topological = new Topological(G.digraph());
for (Integer v : topological.order())
re... |
6c8f7394-96ae-4fea-828f-d8ff1cc39ed6 | 4 | @Override
public void mouseReleased(MouseEvent event) {
if (isEnabled()) {
Row rollRow = null;
try {
rollRow = mRollRow;
if (mDividerDrag != null && allowColumnResize()) {
dragColumnDivider(event.getX());
}
mDividerDrag = null;
if (mSelectOnMouseUp != -1) {
mModel.select(mSelectOn... |
5afeb251-726b-4fe7-90d0-03458b9177dc | 0 | public Date getNextDay(Date date) {
Calendar calendar = getStartOfDate(date);
calendar.add(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime();
} |
0169d53e-50fe-4f18-8726-c90b8b06cea7 | 8 | public static boolean readConfig(String fileName,int nodeid) {
System.out.println("Reading config for"+nodeid);
nodeID=nodeid;
BufferedReader bReader = null;
int nodesCount=0;
try {
bReader = new BufferedReader(new FileReader(fileName));
String line = bReader.readLine();
boolean firstLine=true;
wh... |
6eac5cb0-f1fb-4159-b310-4b90c95b34d4 | 4 | private void printAll(TreeNode root, TreeNode parent, Node parentNode, int i) {
Node p;
int parentPosition = getRectNextLeft(i);
if (root != null && parent == null) {
p = makeNode(String.valueOf(root.key), new Point(parentPosition, getRectNextTop(0)), Node.COLOR_PARENT, i);
... |
2bd8d013-e82b-41a3-8acf-9243d7ab36a7 | 9 | public final static Entry<Integer,String> getNumberFollowedByString(final String str)
{
if((str==null)||(str.length()<2))
return null;
if(!Character.isDigit(str.charAt(0)))
return null;
int dex=1;
for(;dex<str.length();dex++)
if(Character.isLetter(str.charAt(dex)))
break;
else
if(!Character.... |
eb6f2079-5cba-4fde-bfc9-a960544511bc | 8 | public RemoteConsoleServer(InputStream remoteClientIn, OutputStream remoteClientOut) {
this.remoteClientIn = remoteClientIn;
this.remoteClientOut = remoteClientOut;
inputStream = new FilterInputStream(remoteClientIn) {
private void checkRead() throws IOException {
i... |
6d68aa58-66cb-4bd6-a958-8df9d8fd3f5e | 6 | @Override public void onInitSuccess(MidiAccess midiAccess) {
log("Web MIDI initialized.");
//list input ports
log("List of input ports:");
if (midiAccess.getInputs().size() == 0)
log("- (None)");
for (MidiInput mi : midiAccess.getInputs())
log("- " + mi.port.name);
//list output ports
log("List of o... |
3eaf3cb3-2dbb-4720-adc1-29288aad237b | 6 | public void sendToPlayer (Player player, Location location, float offsetX,
float offsetY, float offsetZ, float speed, int count)
{
try
{
Object packet = nms_packet63WorldParticles.newInstance();
Reflection.setValue(packet, "a", name);
Reflection.setValue... |
b0fcbb79-fc14-44b3-90e7-05f0df07782e | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
e30b9c6f-1f92-42fc-aff5-07458eaa2f5e | 1 | ByteVector put12(final int b, final int s) {
int length = this.length;
if (length + 3 > data.length) {
enlarge(3);
}
byte[] data = this.data;
data[length++] = (byte) b;
data[length++] = (byte) (s >>> 8);
data[length++] = (byte) s;
this.length =... |
69958e5a-367c-426b-9f43-e39d8d3f7e25 | 1 | public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException
{
//Step 1:获得dom解析器工厂(工作的作用是用于创建具体的解析器)
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
//Step 2:获得具体的解析器
DocumentBuilder db = dbf.newDocumentBuilder();
//Step 3:解析一个xml文件,获得Document对象(根节点... |
15411f48-ac5d-4cd7-86af-c5ce710bac77 | 5 | @Override
public void rewind()
{
switch( channelType )
{
case SoundSystemConfig.TYPE_NORMAL:
if( clip != null )
{
boolean rePlay = clip.isRunning();
clip.stop();
clip.setFramePosition(0);
... |
707c9360-f3c8-452e-aefe-d46302f3de30 | 5 | public int genHeat(Element e) {
Random r = new Random();
switch(e) {
case ICE:
return -r.nextInt(5);
case GAS:
return -r.nextInt(200);
case WATER:
return r.nextInt(20)-10;
case FIRE:
return r.nextInt(75);
case TERRA:
return r.nextInt(30);
default:
return 0;
}
} |
5393b527-a823-4b6c-9572-9eb4d44e1fd3 | 3 | @Override
public void print() {
System.out.println();
System.out.println("Matrix" + rows + "x" + cols);
System.out.println("-------------------------------------------------");
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
try {
... |
e6be1086-8665-4dbe-9d62-1537684e484f | 0 | public int pop() {
return runStack.remove(runStack.size() - 1);
} |
34ea7b9b-4c9c-491a-a75a-8c92857df5f1 | 5 | public double expectedOccurences(String s)
{
double prob = 1.0;
for (int i = 0; i < s.length(); i++)
{
switch (s.charAt(i))
{
case 'A':
prob *= props[0];
break;
case 'T':
prob *= props[1];
break;
case 'G':
prob *= props[2];
bre... |
04d174d9-247e-44fc-bfea-db9418e53ba2 | 7 | private SimpleNode findNodeABRI(SimpleNode node, final int value) {
SimpleNode ret = null;
if (this.root == null) {
throw new RuntimeException("Le noeud [" + this.min + "; " + this.max + "] est vide et ne contient donc pas " + value + " !");
}
if (node == null) {
... |
cdee8a46-8a62-400b-9c6a-e3314fec78a9 | 2 | public static Usuarios sqlLeer(Usuarios usu){
String sql="SELECT * FROM usuarios WHERE idusuarios = '"+usu.getIdUsuario()+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return null;
}
if(!BD.getInstance().sqlFetch()){
return null;
}
u... |
9d5802fb-9f02-492e-b616-157789d1fa09 | 9 | public void uimsg(String msg, Object... args) {
if (msg == "tabfocus") {
setfocustab(((Integer) args[0] != 0));
} else if (msg == "act") {
canactivate = (Integer) args[0] != 0;
} else if (msg == "cancel") {
cancancel = (Integer) args[0] != 0;
} else if (msg == "autofocus") {
autofocus = (Integer) ar... |
92abc1c1-4d50-4695-b8bd-e107423c88fb | 6 | @Override
public Object getValue() {
// find and assemble date appropriately depending on property at this node and type of parent
// TODO: behavior should be configurable via registry (see comment at top of file)
// VirtualDateNode may only be used for datatype VariablePrecisionTime
VariablePrecisionTime r... |
2477ade6-9d1a-402d-8a7b-42b35d92b845 | 6 | public AxisAlignedBB getAxisAlignedBB(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
if (par5 != 0 && par5 != this.blockID)
{
AxisAlignedBB var8 = Block.blocksList[par5].getCollisionBoundingBoxFromPool(par1World, par2, par3, par4);
if (var8 ... |
46caa741-715f-44e9-9eb7-da594a40fcf1 | 9 | private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
int answer;
int selectedRow;
switch (jTabbedPane1.getSelectedIndex()) {
case 0:
selectedRow = bookTable.getSelectedRow();
if (select... |
171afb10-23ac-43bd-a4e8-1f3ba6ae7f51 | 5 | @Override
public void learn(){
int examples = 0;
int max_neuron = Options.getOptions().getMaxNeurons();
while (( neurons.get(0).size() < max_neuron) && (examples < epochs) && !Options.getOptions().getStopped()) {
//We check the pause
checkPause();
//We print the current state
prin... |
f998e909-61a9-43b8-9f24-8ea6c719c3ab | 5 | @Override
public boolean equals( Object obj ){
if( obj == this ){
return true;
}
if( obj == null || obj.getClass() != getClass() ){
return false;
}
CapabilityName<?> that = (CapabilityName<?>)obj;
return id.equals( that.id );
} |
25e8e919-8f25-4679-b647-7f20925315bd | 0 | public void setQuestion(Question question)
{
this.question = question;
notifyListeners();
} |
c35edd0f-f476-4942-8996-e9f503150fbf | 6 | @Override
public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId )
{
StringBuffer cooxml = new StringBuffer();
// chart type: contains chart options and series data
cooxml.append( "<c:bar3DChart>" );
cooxml.append( "\r\n" );
cooxml.append( "<c:barDir val=\"col\"/>" );
cooxml.a... |
a4ad09b6-2db9-45cc-9fa1-f4f9ff55f255 | 2 | @Override
public int hashCode(){
int res = 1;
int prime = 37;
for (RailwayVehicle it : this)
res = prime*res + (it==null ? 0 : it.hashCode());
return res;
} |
d928a065-5f3d-48c7-9788-e22f5eb3bf50 | 3 | public void endPatchRunStatement(ScriptExecutable pScriptExecutable, boolean pWasSuccess) {
try {
if(pScriptExecutable instanceof ScriptSQL){
ScriptSQL lScriptSQL = (ScriptSQL) pScriptExecutable;
Connection lConnection = mDatabaseConnection.getLoggingConnection();
Ca... |
44811aae-0616-4455-bcdc-15084965353c | 2 | private void error(String error) {
synchronized (ui) {
if (this.error != null)
this.error = null;
if (error != null)
this.error = textf.render(error, java.awt.Color.RED);
}
} |
afb1d0de-a746-4ef7-b5d0-e1e30c106284 | 8 | public List<Class<?>> getClassesFromJar(File file, ClassLoader classLoader)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
try
{
final JarFile jarFile = new JarFile(file);
Enumeration<JarEntry> enumeration = jarFile.entries();
while (enumerati... |
8c9b6729-8758-4eda-b936-37297b882d3d | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
8a12b1d6-38ea-4cb1-b65c-02ce267fc627 | 5 | public String readFile(java.io.File file)
{
if(file.exists() && file.canRead())
{
JConsole c = new JConsole();
String data = "";
try
{
java.io.FileReader fs = new java.io.FileReader(file);
while(fs.ready())
{... |
b511df6d-dcd6-4eeb-84d5-15594bb42001 | 0 | @AfterClass
public static void tearDownClass() {
} |
fe25a1cb-2c60-4dad-8cd1-cbb1f26be680 | 7 | public void visitIincInsn(final int var, final int increment) {
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(Opcodes.IINC, var, null, null);
}
}
if (compute != NOTHING) {
// updates max locals
int n = var + 1;
if (n > maxLocals) {
maxLocals = n;
}
}
... |
517dc614-fb53-4b4c-a8b2-c32f094d1639 | 5 | private void doPaintBucketNoDia(int x, int y, int newCol, int currentCol)
{
// make sure it's on the image
if (x > -1 && y > -1 && x < this.getDrawingWidth()
&& y < this.getDrawingHeight() && this.getPoint(x, y) == currentCol)
{
this.drawPoint(x, y, newCol);
... |
e82f7437-49af-4077-8dc4-8dd12365552f | 7 | public static int getMaxNumber(String what) {
int result = 0;
Connection con = DBUtil.getConnection();
Statement st = null;
ResultSet rs = null;
try {
st = con.createStatement();
rs = st.executeQuery("select * from mstx_max");
rs.next();
result = rs.getInt(what);
} catch (SQLException e) {
e.... |
b0fd3f7e-3014-47fb-8b29-2bbd86140505 | 5 | public GameResult play() {
while (true)
{
Player player = gameManager.getNextPlayer();
Move move = player.getMove(board);
try
{
gameManager.applyMove(move, player, turnNumber);
turnNumber += 1;
}
catch (UnknownPlayerException e)
{
System.out.println("Unknown player at... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.