method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ae53a32b-56d9-49ca-ac1f-d060d58e2667 | 3 | public void setPageAmount()
{
switch(Main.currentGame.mode)
{
case "China":
Page = 1;
Pages = 5;
break;
case "MiddleAge":
Page = 1;
Pages = 5;
break;
case "Modern":
Page = 1;
Pages = 5;
break;
}
} |
0aadea80-7324-4866-8744-ea2175ea88a7 | 1 | @Override
public void delete(Object o) throws Exception {
try {
session = obtainSession();
session.beginTransaction();
session.delete(o);
session.getTransaction().commit();
} catch (HibernateException e) {
session.getTransaction().rollback(... |
e0b667dc-f218-4844-b0a8-5298b7115e14 | 7 | */
private void button_pSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_pSaveActionPerformed
//need to build the array of components for checkRegister_()
JComponent[] toCheck = {textfield_pKontoname, password_pPass1, password_pPass2, textfield_pEmail1, textfield_pEmail2... |
0e8bd202-25be-4af6-b931-7126ca6d8a89 | 7 | private void btn_viewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_viewActionPerformed
float rad;
for (int i = 0; i < numPoint; i++) {
if ( (lengthToCenter-maxObjlen)<dataSet[i] && (lengthToCenter+maxObjlen)>dataSet[i] ) {
rad = (lengthToCenter - dat... |
907d5e1c-c974-4a20-884b-ae99ad40de6b | 5 | public static void main(String args[]){
System.out.println("PROGRAM STARTED... CREATING CONNECTION");
Client cl = new Client("localhost", 9999, 2000);
cl.connect();
while(cl.getConnectionStatus() == Client.NOT_YET_CONNECTED){
try{Thread.sleep(20);}catch(Exception e){}
}
if(cl.getConnectionSta... |
af383f9b-700e-4a48-8835-4bff61a9f845 | 8 | public static void main (String[] args)
{
String phrase = ""; // a string of characters
int length; // the length of the phrase
char ch; // an individual character in the string
Scanner scan = new Scanner(System.in);
// Print a program header
System.out.println ();
... |
000cdd70-2898-4a53-99e3-b2fd3c25c621 | 1 | public void run() {
setupRobot();
while (true) {
// Tell each component to act
wheel.act();
radar.act();
gun.act();
targetSelector.act();
execute();
}
} |
05762365-ca62-4cf9-bdd8-07f78988dbfa | 9 | private void testMIPSFile(String cruxFileName, String inFileName, String outFileName) {
System.out.printf("Testing crux file \"%s\", with input from \"%s\" and expected output in \"%s\"\n", cruxFileName, inFileName, outFileName);
useOutBuffer(true);
SysExitException exitException = null;
try {
compiler.compi... |
6d232127-62d4-4c76-892f-e17fe1592ee2 | 8 | private void carregaMapa() throws IOException {
URL url = getClass().getClassLoader().getResource("niveis/nivel.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream()));
String linha;
int z = 0;
while ((linha = in.readLine()) != null) {
if (linha.length() != 7) {
in... |
0fe0de10-17aa-4e4c-ba17-ab00e54edae2 | 2 | public double[] rawPersonTotals(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawPersonTotals;
} |
92dfe8c6-f298-4179-b44b-ce4215c03848 | 1 | private static boolean assertEDT() {
if (!EventQueue.isDispatchThread()) {
throw new AssertionError("Not EDT, but [" + Thread.currentThread() + "].");
}
return true;
} |
d4ed75b8-95a6-431c-aef8-28abb7cbe528 | 3 | @SuppressWarnings("unchecked")
public static void recibirObjeto(Object obj) {
if (obj instanceof ArrayList) {
setCanales((ArrayList<Canal>) obj);
frame.actualizarJTree();
} else if (obj instanceof String) {
frame.escribir((String) obj);
} else if (obj instanceof MensajeAudio) {
reproducirAud... |
fc30e6ad-2bc0-4d91-988c-149b4cb00b2a | 9 | public void setMaximumDepth(float m) {
if (m < 0.0f)
throw new IllegalArgumentException("Potential well depth cannot be negative");
v1 *= max / m;
max = m;
if (format != null) {
if (max >= 1000f)
format.applyPattern("####");
else if (max >= 100f)
format.applyPattern("###");
else if (max >= 1... |
969bcb3a-22fb-4812-9f5f-66c251316378 | 6 | private void censored(int row) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
return;
}
OutDetail selectedRow = result == null ? null : result.get(row);
if (selectedRow != null) {
int result = JOptionPane.showConfi... |
9100edcc-b337-4e94-9acc-385cffcb5b32 | 1 | public Event(ModelProxy<?> modelProxy) {
super();
this.modelProxy = modelProxy;
} |
ee39ac57-3cf3-47c3-b946-35814d75672d | 3 | private static String loadShader(String fileName) {
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
final String INCLUDE_DIRECTIVE = "#include";
try {
shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName));
... |
85d7841b-a65e-48a9-89d8-a219344e2456 | 1 | public static void main(String[] args)
{
ExceptionTest1 test = new ExceptionTest1();
System.out.println("Invoke Before !");
try
{
test.method();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
System.out.println("From Finally Src !");
}
System.out.println("Invoke After !"... |
464b2733-3105-4176-9412-1635664e26b6 | 9 | private void initData() {
if(DataFlowControler.getCurrentEvent().getEquipments() != null) {
if(DataFlowControler.getCurrentEvent().getEquipments().size() > 0) {
ArrayList<Equipment> eqs = DataFlowControler.getCurrentEvent().getEquipments();
for(int i = 0; i< eqs.size(); i++) {
switch (eqs.get(i).getTy... |
a8bf8460-fecf-4fb1-9679-987ff20747db | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
7b28559e-aa8f-479d-a096-4c5a786d4f64 | 1 | public Annotation[][] getAnnotations() {
try {
return new Parser(info, constPool).parseParameters();
}
catch (Exception e) {
throw new RuntimeException(e.toString());
}
} |
ffcf55a6-24fb-440d-a600-d04955976b15 | 8 | public final long nextSubId() {
if (offset >= raw.length)
return -1;
long ret = 0;
char c = (char) (raw[offset] & 0xff);
if (c == '.')
throw Errors.newASN1Error(runtime, "Sub identifier cannot start with '.'");
... |
27897c87-0ed5-4249-853f-bdb02e7dc44c | 2 | private static void closeReader(Reader reader)
{
try
{
if (reader != null)
{
reader.close();
}
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
} |
494d775b-6b3d-45a1-aaf2-c78c0b1cd45c | 6 | public static void startupNewPprint() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$,... |
73f55b51-4057-4ba1-87e5-8d2442576360 | 8 | public static void doTopics(MOB mob, Properties rHelpFile, String helpName, String resName)
{
StringBuffer topicBuffer=(StringBuffer)Resources.getResource(resName);
if(topicBuffer==null)
{
topicBuffer=new StringBuffer();
final Vector<String> reverseList=new Vector<String>();
for(final Enumeration<Objec... |
f8aad6cc-7ee8-4107-9566-0a9d42ab5295 | 2 | public void doTransformations() {
for (Iterator i = getChilds(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (ident instanceof ClassIdentifier) {
((ClassIdentifier) ident).doTransformations();
} else
((PackageIdentifier) ident).doTransformations();
}
} |
56a68c44-c3ad-4ffa-8508-8144a7eb8906 | 4 | public void calcSignedDistanceField() {
// Set up signed distance field
Vector3d minCoords = new Vector3d();
Vector3d maxCoords = new Vector3d();
for (Iterator<Vector3d> it = vertices.iterator(); it.hasNext();) {
Vector3d vertex = it.next();
minCoords.set(Math.min(vertex.x, minCoords.x),
Math.min(ve... |
9172500f-0f02-4d91-aaf4-c88c01dae958 | 0 | public DaemonThreadPoolExecutor() {
super(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory());
} |
c3defa99-b505-4828-b8a4-6fe903b0956e | 0 | public List<ValidableEntity> getEntityList() {
return entityList;
} |
71902368-8325-4062-b671-7c47b05c54b4 | 4 | private Token tokenizeStringLiteral() {
String stringLine = source.get(currentLine);
int stringLength = 0;
int quoteCount = 0;
do {
if (stringLine.charAt(stringLength) == '"') {
quoteCount ++;
}
stringLength ++;
} while (stringL... |
d95051b8-4d17-41ef-bd77-cb3e4808a649 | 5 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
if (("".equals(jTextField6.getText()))){
this.msj_usuario_Error("Complete TODOS los Campos.");
}
else{
r_con.Connec... |
b817dc69-83f6-42b1-82ab-60d5876ff5fb | 8 | public static int countNeighbours(boolean[][] world, int col, int row) {
int c = 0;
if (getCell(world, col - 1, row - 1) == true) {
c += 1;
}
if (getCell(world, col, row - 1) == true) {
c += 1;
}
if (getCell(world, col + 1, row - 1) == true) {
c += 1;
}
if (getCell(world, col - 1, row) == tr... |
7bf22ea7-c8c1-447b-aa18-56b90e6900eb | 4 | public int receive(byte[] data) {
int bytesRead = 0;
try {
if (senderSocket == null) {
senderSocket = tcpReceiverSocket.accept();
in = senderSocket.getInputStream();
out = senderSocket.getOutputStream();
}
if (in != null... |
2fbb4edf-825b-4577-915e-a1e4c6f52787 | 7 | @Override
public Deck getCommunityCards() {
if (community.isEmpty()) {
return new Deck();
} else if (!doneFlop || community.size() < 3) {
return new Deck(community.subList(0, 1));
} else if (!doneTurn || community.size() < 4) {
return new Deck(community.su... |
ca18c18d-af36-4aef-bd73-7327c23aa3e6 | 2 | public void setInit(InstructionBlock initBlock) {
if (type == POSSFOR) {
this.initBlock = initBlock;
} else if (type == FOR) {
this.initInstr = initBlock.getInstruction();
initBlock.removeBlock();
}
} |
d1034dd9-54a5-48dd-9bfc-45efa850bdf5 | 8 | void prefetch_all_headers(Info first_i,Comment first_c,
int dataoffset) throws JOrbisException {
Page og=new Page();
int ret;
vi=new Info[links];
vc=new Comment[links];
dataoffsets=new long[links];
pcmlengths=new long[links];
serialnos=new int[links];
for... |
10ca73db-8d3d-4163-9c3f-1da7050377a8 | 7 | private boolean checkIfNewUser(String pid, Document doc)
{
if (pid == null || doc == null){
throw new IllegalArgumentException("pid or doc are null");
}
Element docEle = doc.getDocumentElement();
if (docEle == null) {
return true;
}
NodeList n... |
91843ac4-abcc-469d-a07c-a6f9efaa0d37 | 4 | protected void checkAllPoints(){
for(int i = 0; i < storedPoints.length; i++){
checkPoints[i] = storedPoints[i].checkHeldContainer();
}
boolean result = false;
for(boolean check : checkPoints){
if(check == false){
result = false;
... |
e1c0d34a-1046-40ee-9b46-40f9ad4867c4 | 4 | public void equipWeapon(Survivor survivor, Weapon weapon) throws CantEquipWeaponException {
if (! this.survivors.contains(survivor)) {
throw new CantEquipWeaponException(CantEquipWeaponException.notInTheTeam(survivor));
} else if (! this.mainBase.getAvailableWeapons().contains(weapon)) {
throw new CantEquipWe... |
f490549d-ddf9-486a-a131-49493e21d3d9 | 4 | public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage: java MD md-algorithm filename");
System.exit(0);
}
try {
// MessageDigest-Objekt erstellen (Algorithmus z.B. SHA-1 oder MD5)
MessageDigest md = MessageDigest... |
99dcab4a-46ad-482c-abc9-128fa2f35e0e | 2 | public static boolean isPrime(long n){
int checkTo = (int) (Math.sqrt(n)+1);
for(int i=2;i<checkTo;i++){
if(n%i==0){
return false;
}
}
return true;
} |
3485e00a-ce2d-4abf-bd81-117e1cde795e | 7 | public void setOptions(String[] options) throws Exception {
String manualS = Utils.getOption("manual", options);
if (manualS.length() > 0) {
double val = Double.parseDouble(manualS);
if (val >= 0.0) {
setManualThresholdValue(val);
}
}
String classString = Utils.getOption... |
e32bf289-dc07-4e4b-8a56-ae2c1570871a | 1 | protected void processKeybindEvent(KeybindEvent e) {
if(keybindListener != null) {
keybindListener.KeybindTouched(e);
}
} |
9ea3b634-68db-4c2e-bd17-18f3544d207d | 4 | public void setFolder(final File folder, final boolean clearCache) {
chunks.clear();
if(clearCache) {
MapReader.clearCache();
}
final File[] files = folder.listFiles(new FileFilter() {
@Override
public boolean accept(final File f) {
return f.isFile()
&& f.getName()... |
fc7502a3-3dfb-41ad-b8f2-dedbdc3edc1e | 9 | @Override
protected void executeSearch() {
// Get the sources in the universe
SearchEntity search = getSearchEntity();
List<SourceInstanceEntity> sourceInstances = sourceInstanceFacadeREST.findAllInUniverse(search.getUniverse().getId());
ArrayList<AbstractSource> sources = new ArrayList<AbstractSource>();
f... |
2478a1c3-20d7-4f43-a8ca-790c93936409 | 1 | public void addProductions(Production[] productions) {
for (int k = 0; k < productions.length; k++) {
addProduction(productions[k]);
}
} |
9594d4aa-79c1-4f05-ad05-0b4edec872bc | 3 | public int numberOfPieces(int piece) {
int num = 0;
for (int i = 0; i < this.board.length; i++) {
for (int j = 0; j < this.board[i].length; j++) {
if (this.board[i][j] == piece) {
num++;
}
}
}
return num;
} |
05dafc08-ce0e-45b4-848b-294b4626da96 | 3 | @Override
public void run() {
System.out.println("The tread number " + numderTread + " started.");
while (!stopTread) {
int rows = MatrixDouble.getRowsForThreadWithInkrement();
//System.out.println("The tread number " + numderTread + ". Rows = " + rowsA + ".");
... |
45d2d898-d9f7-4a62-9fd6-0e738da85ec5 | 2 | private void initNoise(){
for (int x = 0; x < noise.length; x++) {
for (int y = 0; y < noise[0].length; y++) {
noise[x][y] = random.nextInt(255);
}
}
} |
0ce8cb91-0c61-4497-803b-2e49acaf1f40 | 0 | public void setQuery(String query) {
this.query = query;
} |
2950fd17-7312-40a7-8046-619330c32556 | 0 | public void setPreference(Preference pref) {
this.pref = pref;
} |
5c6723e4-d053-40ca-9718-86ed46a09afe | 8 | public String[] Myself(boolean place)
{
try{
driver.get(baseUrl + "/content/lto/2013.html");
//global landing page
driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[3]/ul/li/a")).click();
//Brunei landing page - Order Now button
driver.findElement(By.xpath("/htm... |
812cef4e-6995-4ced-843f-54dabc364e52 | 2 | public LocalVariableTable(int maxLocals, LocalVariableInfo[] lvt) {
locals = new LocalVariableRangeList[maxLocals];
for (int i = 0; i < maxLocals; i++)
locals[i] = new LocalVariableRangeList();
for (int i = 0; i < lvt.length; i++)
locals[lvt[i].slot].addLocal(lvt[i].start.getAddr(),
lvt[i].end.getAddr... |
72ce8d0b-871a-4b27-9aa2-80828ea60a97 | 9 | public void searchAvailableCells(){
for (int i = 0; i < 8; i++) {
switch (i) {
case 0:
this.testAvailabe(-1, 0, i);
break;
case 1:
this.testAvailabe(1,0, i);
break;
case 2:
this.testAvailabe(0, 1, i);
break;
case 3:
this.testAvailabe(0, -1, i);
brea... |
f7a05498-b8e6-44cd-8ea8-08df603e4798 | 1 | @Override
public synchronized void send(byte[] bytes) {
try {
outputStream.write(bytes);
}
catch (IOException e) {
notifyListeners(e);
}
} |
e30b1936-da3a-4bc7-b4ba-31a4a1825fc7 | 0 | public final String getVersion() {
return _version;
} |
2e958a49-fac3-4ccf-a3d3-545ff11728c7 | 5 | public void paint(Graphics g){
if (environment != null) {
Sudoku env = (Sudoku) environment;
Board board = env.getBoard();
int n = SudokuLanguage.DIGITS;
int sqrt_n = (int) (Math.sqrt(n) + 0.1);
g.setColor(Color.lightGray);
Font font = g.getFont();
... |
7f9cb14f-c47e-4e4a-a0cb-223cdb831adb | 1 | public void log(Object... args) {
String output = "";
for (Object arg: args) {
output += arg + " ";
}
System.err.println(output);
} |
481300a2-6e59-44b0-8e61-e01e0c64479e | 5 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("ALTER TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n ");
if(this.ren) {
sB.append(" RENAME TO ");
sB.append(this.renTo.repla... |
1f1e51c5-06bf-4b82-8505-cbb12e161dde | 5 | @Override
public void putAll(Map<? extends K, ? extends V> m) {
boolean saveResizeDisabled = resizeDisabled; //just in case I'm nesting it.
resizeDisabled = true;
for (Entry<? extends K, ? extends V> e : m.entrySet()) {
put(e.getKey(), e.getValue());
}
resizeDis... |
c3b4afed-c5b2-47a3-8617-692d5ac0abaf | 5 | @EventHandler
public void onSignChange(SignChangeEvent event) {
Player p = event.getPlayer();
if (p.isOp()) {
Block block = event.getBlock();
Material type = block.getType();
if (!(type.equals(Material.SIGN) || type.equals(Material.SIGN_POST) || type.equals(Material.WALL_SIGN))) {
return;
}
St... |
34d0a5da-9086-4066-8ab8-a2ea6f589b4d | 9 | public FrameData decodeFrame(final int mode){
FrameData fd = null;
if (mode == Constants.HUFFMAN_DOMAIN){
int mdb = 0;
fd = new FrameData(header.get_channels(), header.get_max_gr());
decoder.read_side_info(fd);
byte [] buffer = bitstream.get_main_data();
if( (mdb = fd.getMainDataBegin()) !... |
8f539a83-d2d3-447f-ba49-1d0c9fe3be9c | 6 | public void testDragoonDemotedByBrave() {
Map map = getTestMap(plains);
Game game = ServerTestHelper.startServerGame(map);
InGameController igc = ServerTestHelper.getInGameController();
List<CombatResult> crs;
Player dutch = game.getPlayer("model.nation.dutch");
Player i... |
4cb2f800-7c03-4ffe-9c47-c6aee7d5ae3e | 8 | private List getVirtualSelection() {
List result = new ArrayList();
int[] selectionIndices = doGetSelectionIndices();
if (getContentProvider() instanceof ILazyContentProvider) {
ILazyContentProvider lazy = (ILazyContentProvider) getContentProvider();
for (int i = 0; i < selectionIndices.length; i++) {
... |
4682922c-9f85-4c3a-9525-2de7245f78d3 | 4 | public void freePage(PageId globalPageId) throws
InvalidBufferException,
ReplacerException,
HashOperationException,
InvalidFrameNumberException,
PageNotReadException,
BufferPoolExceededException,
PagePinnedException,
PageUnpinnedException,
HashEntryNotFoundException,
BufMg... |
e7727615-6291-42ff-8bd6-207861616bbd | 5 | @SuppressWarnings("unchecked")
public Object get(String nodeName)
{
Object result = null;
if (config.containsKey(nodeName))
{
result = config.get(nodeName);
}
else
{
if (nodeName.contains("."))
{
final S... |
c12129fb-52d1-4c7e-bd55-6477b220d5f0 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
invoker=mob;
final CMMsg msg=CMClass.getMsg(mob... |
2299e8e3-7fcf-4feb-8ded-d5e068028ef5 | 8 | public void solve(char[][] board) {
//X O
if(board==null|| board.length==0) return;
init(board);
//first and last row
for(int j=0;j<width;j++)
{
visitAroundNoTurn(0, j, board);
visitAroundNoTurn(height-1,j, board);
}
//first and last column
for(int i=0;i<height;i++)
{
visitArou... |
d58e0085-813f-4bc1-aeb7-0636d0f9a8ff | 8 | public static Book parseBook(String data) throws IOException {
Book book = new Book();
try {
String tokens[] = data.split("[=]|[\\{]|[\\}]|[,]");
if(data.indexOf("Book") != -1 || tokens.length > 0) {
for( int i = 0; i < tokens.length ; i++) {
... |
7db36555-1fc0-4e32-83d2-fff6d1743ac6 | 3 | String retFunc(int nRows, int nCols, Character[][] res) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < nRows; ++i) {
for (int j = 0; j < nCols; ++j) {
if(res[i][j] != null)
sb.append(res[i][j]);
}
}
return sb.toString();
} |
bff5b0e3-3c22-4efa-a69a-60fa7a73977b | 1 | public boolean kontroliertAsien(Spieler s) {
boolean res = true;
if(!s.fraktion.equals(laenderGraph.getLaenderList().getLandByID(3).getOwner())) {
res = false;
}
return res;
} |
aa45ac3a-4f65-4f86-ac3a-84c6c1d7e6b7 | 9 | public static Stella_Object copyPropositionArgument(Stella_Object self, KeyValueMap mapping) {
{ Stella_Object copy = mapping.lookup(self);
if (copy != null) {
if (Logic.descriptionModeP()) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(copy);
if (Surrogate.subtypeO... |
cf597ee0-278f-4188-a319-d6827e9b6262 | 8 | @EventHandler
public void onTarget(EntityTargetEvent event) {
if (!event.isCancelled()) {
if (event.getTarget() instanceof Player) {
Player player = (Player) event.getTarget();
if (plugin.disguiseDB.containsKey(player.getName())) {
if (player.hasPermission("disguisecraft.notarget")) {
if (playe... |
ed0f5fc5-f138-4aed-9690-d293a5566db6 | 7 | @Override
protected void checkAction(String name)
{
if(name == "Player Name")
{
Util.writeOutput("Please Enter Player Name.");
player = true;
town = false; msk = false; fsk = false; mw = false; fw = false;
}
else if(name == "Town Name")
{
Util.writeOutput("Please Enter Town Name.");
town ... |
e47c6db9-ef90-4118-bced-47df87a73466 | 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... |
f4b8549b-b581-452c-92f6-e0771bc8cf92 | 7 | static String fillContent4Dao(String packageName, String tablename, Connection conn) throws SQLException {
String sql = "select * from " + tablename + " limit 1";
String Tablename = Utils.upperFirstChar(Utils.delUnderline(tablename));
ResultSet rs = conn.prepareStatement(sql).executeQuery();
StringBuilder sb = ... |
76c8d620-d7d9-4b7a-be39-7a65a0558c6d | 9 | public boolean sendFile(FileMeta meta, File file) throws IOException {
if (socket == null) {
throw new IllegalStateException("No open connection!");
}
logger.debug("Pushing new file: ");
socket.getOutputStream().write(ConnectionMessages.SERVER_FILE_PUSH.getBytes());
... |
75afbaf7-742d-4942-a9a2-21575fc0cab1 | 5 | @Override
public void run() {
System.out.println("starting ListenerThread");
// TODO exact delta time
while (true) {
Controllers.poll();
for (int i = 0; i < Controllers.getControllerCount(); i++) {
Controller controller = Controllers.getController(i);
if (controller.getName().toLowerCase... |
b9954f01-1825-43c1-a0aa-bb78eefd5711 | 7 | public int computeEnd() {
int index = this.start;
while (this.signature[index] == '[')
index++;
switch (this.signature[index]) {
case 'L' :
case 'T' :
this.end = CharOperation.indexOf(';', this.signature, this.start);
if (this.bracket <= this.start) // already know it if its > start
this.bra... |
6069f09c-2a7e-4b04-a698-4d7c6a1acad5 | 0 | public static String capitalize(String str) {
return changeFirstCharacterCase(str, true);
} |
eaa7bda2-0648-451c-a5a3-5216b4433e45 | 2 | private void checkGuessAndFeedbackMatch(List<String> guessHistory, List<String> feedbackHistory,
String code){
check(guessHistory.size() == feedbackHistory.size(),"hisotry size mismatch",guessHistory,
feedbackHistory);
Iterator<String> git = guessHistory.iterator();
Iterator<String> fit = feed... |
25e43aa1-bbd3-4c6b-a885-c24520648fe9 | 9 | private String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
Exception exception = null;
InputStream stream = ResourceLoader.getResourceAsStream(filename);
BufferedReader reader;
try{
reader = new BufferedRe... |
b15eff7b-9a94-4f0d-85ef-30087774c094 | 5 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
String value = "account";
boolean status = false;
if (mode == 2) {
value = "nym";
}
if (jTable6.getSelectedRow() < 0) {
JOptionPane.showMessageD... |
4a5a5be5-6ffa-4c36-b3c8-8d5373da2da4 | 5 | private void upgradeToWebSocket() throws IOException, NoSuchAlgorithmException {
if (!"websocket".equalsIgnoreCase(getFirstHeader("upgrade"))) {
throw new HttpResponseException(HttpStatusCode.BAD_REQUEST, "BAD REQUEST: Invalid upgrade request");
}
int version = getFirstHeaderAsInt("sec-websocket-version");
i... |
ad095e07-ff5d-4d32-ab33-b49262118ad4 | 1 | public void printPassportNumberStr(String enteredPassportNumber, boolean lineSeparator) {
if (lineSeparator) {
System.out.printf("Passport number: %s\n", enteredPassportNumber);
} else {
System.out.printf("Passport number: %s", enteredPassportNumber);
}
} |
85281e48-7d12-4911-90e4-47f3c6df2093 | 8 | public double getPerformance(int evaluation) {
double result;
result = Double.NaN;
switch (evaluation) {
case EVALUATION_CC:
result = m_CC;
break;
case EVALUATION_RMSE:
result = m_RMSE;
break;
case EVALUATION_RRSE:
result = m_RRSE;
break;
case EVALUATION_MAE:
res... |
66c1c49d-9a18-4456-a5f0-ad9ee32a7938 | 9 | public void setZero(int[][] matrix)
{
if(matrix.length ==0 || matrix[0].length==0) return;
int[] row = new int[matrix.length];
int[] col = new int[matrix[0].length];
for(int i=0; i<matrix.length; i++)
{
for(int j=0; j<matrix[0].length; j++)
{
if(matrix[i][j] == 0)
{
row[i] = 1;
col... |
7fa95f0c-28f2-4336-ae14-b4eb971012b3 | 1 | public PreviewPanel(final SkinPropertiesVO skinproperties) {
if (skinproperties == null) {
throw new IllegalArgumentException();
}
this.skin = skinproperties;
this.btnAccPreview = new AccBtnPreview(skinproperties, this);
this.btnLocalePreview = new LocaleBtnPreview(s... |
6cad22b8-8902-4f65-8431-daa71f796d32 | 3 | @Override
public String toFormattedString()
{
String output = m_exp1.toFormattedString() + " ";
if ( m_op == Op.PLUS )
output += "+";
else if ( m_op == Op.MINUS )
output += "-";
else if ( m_op == Op.TIMES )
output += "*";
else
... |
bc191bd4-8570-4ac2-a337-b1a6b73cc0c0 | 5 | public boolean detachPrevious(Linkable paramLinkable)
{
boolean b = false;
if ((paramLinkable instanceof InstructionList))
{
InstructionList localInstructionList = (InstructionList)paramLinkable;
if (localInstructionList.getNextInstruction() == this)
{
if ((this.prev == localIn... |
51cdfc5f-ba68-4f09-a337-237ceb28208e | 0 | private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
//Se crea un objeto y se muestra la interfaz de eliminar
Eliminar eliminar = new Eliminar();
eliminar.setVisible(rootPaneCheckingEnabled);
}//GEN-LAST:event_jMenuItem3ActionPer... |
733bc823-df94-4041-b919-d6d9ed17e1a3 | 3 | @Override
public boolean init() {
if (isPinWindowOpen()) {
log("Parsing bank pin.");
String sPin = getContext().getAccount().getPin();
if (sPin.length() < 4 || sPin.equals("null")) {
log("You must enter a valid bank pin in accounts!");
... |
ec450845-232f-462a-bd69-060bd9a5e882 | 7 | public static long parseTimeInterval(String str) {
try {
int len = str.length();
char suffix = str.charAt(len - 1);
String numstr;
long mult = 1;
if (Character.isDigit(suffix)) {
numstr = str;
} else {
numstr... |
dabe8157-eaa4-410e-8137-2b334be5dead | 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)) {
... |
1ce353ba-5bd5-4197-8ba4-a77faee90689 | 7 | public final void run()
{
try
{
while(_running)
{
try
{
loop();
}
catch(InterruptedException e)
{
LogSupport.ignore(log,e);
}
... |
89970924-3cfb-4643-9ad3-4b61406a208e | 9 | private static void errorList(int errorNumber) {
switch (errorNumber) {
case 0:
System.out.println("运行成功");
break;
case 1:
System.out.println("没有这个用户");
break;
case 2:
System.out.println("密码错误");
... |
c2249bde-4f71-40ec-9373-6a615a176ac0 | 2 | public Object getChild(Object parent, int index) {
Object o = null;
if(parent.getClass().getName().contains("SPFolder")){
if(((SPFolder) parent).getChildNodes().size() < index){
return null;
}else{
o = ((SPFolder) parent).getChildNodes().get(index);
}
} else {
o = null;
}
return o;
... |
7c46e10d-7006-40e4-8895-3cf5d4eb634a | 5 | public void checkRight(Node node) {
this.right = -1; // reset value to -1
// Prevent out of bounds
if((node.getY()-1) < this.size.getY()) {
if(checkWall(new Node( (node.getX()), (node.getY()+1) ))) {
if(this.closedNodes.size()==0)
this.right = 1;
else {
for(int i = 0; i < this.closedNodes.siz... |
20f3d9d9-446a-40f4-9ba7-21b40a426e39 | 3 | @Override
public void run() {
loader.run();
java.util.List<ThreeTuple<Vector2, Vector2, Vector2>> coords = parse(loader.image);
textures = new SimpleTexture[coords.size()];
Collections.sort(coords, new Comparator<ThreeTuple<Vector2, Vector2, Vector2>>() {
@Override
... |
9e1d34bf-5179-4c4a-84b5-421ea1f2dbed | 6 | public static boolean computeConstCond(OP op, int v1, int v2) {
switch (op) {
case BNE:
return v1 != v2;
case BEQ:
return v1 == v2;
case BLE:
return v1 <= v2;
case BLT:
return v1 < v2;
case BGE:
return v1 >= v2;
case BGT:
return v1 > v2;
default:
throw new IllegalArgumentException("... |
3730e202-f254-46eb-a838-5299f8705e5b | 1 | public Node getNode(int bit, Node node)
{
if(bit == 1)
return node.right;
else
return node.left;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.