method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ef7f386a-39f5-41b7-9e9b-706531637515 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (empNoEmpleado != null ? empNoEmpleado.hashCode() : 0);
return hash;
} |
7dc103ca-9a19-49cf-a620-e6e0fb9b4d53 | 6 | public void printArray(PrintableStringWriter stream) {
{ two_D_floatArray self = this;
{ int nofRows = self.nofRows;
int nofColumns = self.nofColumns;
int limit = 9;
stream.print("|i|[");
{ int row = Stella.NULL_INTEGER;
int iter000 = 0;
int upperBound000 ... |
5af94e89-2c7f-46a0-af17-e62ff4378512 | 8 | protected boolean isAQualifyingScriptHost(final PhysicalAgent host)
{
if(host==null)
return false;
for(final Enumeration<Behavior> e = host.behaviors();e.hasMoreElements();)
{
final Behavior B=e.nextElement();
if((B!=null) && B.isSavable() && (B instanceof ScriptingEngine))
return true;
}
for(fi... |
3bdccfe7-30ee-4e45-9d56-8168536550ef | 0 | private FileToPNG() {
} |
7cecec1d-55df-4447-82e8-4adf5036682e | 1 | private void run() throws IOException {
// Make connection and initialize streams
String serverAddress = "localhost";
Socket socket = new Socket(serverAddress, 6969);
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
out = new PrintWriter(sock... |
3454bace-d1a5-4861-b81e-39531289f792 | 4 | public static ArrayList<Long> loadIsbns(String filename) {
ArrayList<Long> toBeAdded = new ArrayList<Long>();
try {
Scanner fileIn = new Scanner(new File(filename));
int lineNum = 1;
while (fileIn.hasNextLine()) {
String line = fileIn.nextLine();
Scanner lineIn = new Scanner(line);
lineIn.us... |
be5b3c05-4b58-494c-84c3-9b257203cac9 | 1 | @Test
public void testWriteNoteEntity() throws IOException {
System.out.println("writeNoteEntity");
final String testTitle = "Test-Titel";
final String testBody = "Test-Body { [ : \\ ÄÖÜ \" ";
int numFilesBefore = service.list().size();
NoteEntity n = new NoteEntity(testTi... |
01591d23-9031-491d-9513-2d435a5159e5 | 6 | public static KeyValueMap yieldJustificationSubstitution(Justification justification, KeyValueMap substitution, Proposition argument) {
{ Proposition top = justification.proposition;
Proposition proposition = ((argument == null) ? top : argument);
{ Stella_Object arg = null;
Vector vector000 = ... |
0f6da059-7765-4a4b-96e4-34a5b5bf5964 | 1 | public byte[] getStringBytes() { // readBytes
int off = offset;
while (payload[offset++] != 10) {
;
}
byte buf[] = new byte[offset - off - 1];
System.arraycopy(payload, off, buf, off - off, offset - 1 - off);
return buf;
} |
3fa9be29-e41d-42c4-a560-46c719ed6316 | 9 | @Override
public double getClippedValue(double input, double clip) {
double result = 0;
double flag = 0;
if (input >= a && input <= b) {
flag = (input - a) / (b - a);
if (result < clip) {
result = flag;
} else {
result = cli... |
b9229891-f05c-434f-b819-3c7b7f773192 | 3 | @Override
public String toString() {
StringBuilder sb = new StringBuilder("map(");
sb.append(widthMap);
sb.append(", ");
sb.append(heightMap);
sb.append(")\n");
for(int j=0; j<this.heightMap; ++j) {
for(int i=0; i<this.widthMap; ++i) {
if(this.map[i][j]==-1) {
sb.append(" ");
}
else {
... |
fed82e9d-39a2-4f80-bb05-a836850fc53a | 2 | public void testPropertyCompareToDay() {
YearMonthDay test1 = new YearMonthDay(TEST_TIME1);
YearMonthDay test2 = new YearMonthDay(TEST_TIME2);
assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0);
assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0);
assertEquals(tr... |
1898c1ff-5baa-4a4e-b5d9-8ce92fa8e1ac | 4 | private Point getComputersSelection() throws Connect4Exception {
Point coordinate;
try {
coordinate = this.findWinningLocation(game.getCurrentPlayer());
if (coordinate != null) {
return coordinate;
}
coordinate =... |
c136cf66-68e2-463a-ab24-f07203504091 | 1 | public boolean InsertarTrabajo(Trabajo p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
eca3f983-7c4c-42e0-8b46-897280129209 | 4 | private int AttemptSave(LinkedList<PlayerReinforcement> toSave) {
boolean attemptRecovery = false;
try {
getDatabase().save(toSave);
} catch (Exception ex) {
attemptRecovery = true;
Citadel.warning("DB mass save failure: " + ex.toString... |
1df99a4c-8d12-4776-9b62-d30a1933764f | 1 | public void openStream() throws UnsupportedAudioFileException, IOException {
if (this.isMpeg) {
this.mpegInputStream = AudioSystem.getAudioInputStream(this.inStream);
AudioFormat baseFormat = this.mpegInputStream.getFormat();
AudioFormat decodedFormat = new AudioFormat(AudioForm... |
4ff82de2-3154-447f-a606-e85460cf368c | 1 | @Override
public void pop() {
if (amount > 0) {
head = head.nextReturn();
amount--;
}
} |
c743fe0e-3f82-4e56-9089-116f5b7bb9b4 | 5 | public void encodeFile(File file) {
try {
Color[] colorArray = fileToColorArray(file);
int colorCounter = 0;
for (int yScroll = 0; yScroll < currentImg.getHeight(); yScroll += this.heightMod) {
for (int xScroll = 0; xScroll < currentImg.getWidth(); xScroll +... |
b74c2429-8df7-4e0d-bf61-9e8b8b0daaa1 | 7 | @Override
public void actionPerformed(ActionEvent action) {
// TODO Auto-generated method stub
if(action.getSource() == btnSend){
String message = txtBox.getText();
String showMessageForMe = "me: " + message + "\n";
message = message.replace("<", "<");
message = message.replace(">", ">");
Str... |
3f32841b-552e-404f-b6a9-d9394a4056e8 | 4 | @Override
public void run() {
try {
if (debug) Gpr.debug("Running thread");
String page = getData();
parse(page);
if (debug) Gpr.debug("Thread finished");
} catch (Throwable t) {
if (debug) t.printStackTrace();; // Do nothing if it fails
}
} |
08146eac-0dd8-457a-8e4b-7e241d0026fd | 1 | private void botonGuardarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarPersonaActionPerformed
borrando = false;
LinkedHashMap<Integer, Persona> personas = deTablaAMapPersonas();
//ArrayList<Persona> personas = deTablaAArray();
FicherosDatos fd = ne... |
69313dff-c794-41c1-822e-1e4dae98116d | 8 | public Terminal.Color[] getColor(int number) {
final Terminal.Color colors[] = { Terminal.Color.DEFAULT, Terminal.Color.DEFAULT };
switch (number) {
case 2:
colors[0] = Terminal.Color.BLACK;
colors[1] = Terminal.Color.WHITE;
break;
case 4:
colors[0] = Terminal.Color.WHITE;
colors[1] = Terminal.... |
2715c6f8-2720-4b42-9ca1-2a1c1d232873 | 7 | public boolean updateAnnotation(Annotation annotation) {
// bail on null annotations
if (annotation == null) {
return false;
}
// make sure the page annotations have been initialized.
if (!isInited) {
try {
initPageAnnotations();
... |
b7d602a7-d5c7-4a7a-90b0-a5521aab6813 | 8 | public static void loadSchemeTypes()
{
System.out.println("Loading Scheme Card Types...");
schemeCardTypes = new ArrayList<SchemeCardType>();
File file = new File("legendary" + File.separator + "definitions" + File.separator + "scheme_types.txt");
if (file.exists())
{
try
{
BufferedReader br... |
0fa9b9f1-d19e-4633-9294-d17921043527 | 0 | public int getLivingPlayerCount() {
return livingplayers.size();
} |
517b3bdc-51dc-40f3-a03d-bfdc84936747 | 0 | public void setName(String name) {
this.name = name;
} |
d7c2f0fb-7d77-46ea-b1dc-f192257cbe16 | 4 | @Override
public void render() {
super.render();
ArrayList<Long> selected = Application.get().getLogic().getGame().getSelectedWeapons();
if(selected.size() > 0) {
if(selected.size() > 1) {
int i = 0;
for(long a : Application.get().getLogic... |
995fc56d-67a0-4257-a1e4-d749d1a61d9d | 9 | private void bracketing(PhraseStructure phraseStructure, int start, int end, PhraseStructureNode parent) throws MaltChainedException {
int bracketsdepth = 0;
int startpos = start-1;
for (int i = start, n = end; i < n; i++) {
if (input.charAt(i) == STARTING_BRACKET
// Start BracketProgLangReader
&& (i... |
3c9689ea-1437-45e7-8ba4-04eccc322b08 | 7 | public Type getSpecializedType(Type type) {
/*
* tArray(x), iface -> tArray(x) iff tArray implements iface tArray(x),
* tArray(y) -> tArray(x.intersection(y)) tArray(x), other -> tError
*/
if (type.getTypeCode() == TC_RANGE) {
type = ((RangeType) type).getBottom();
}
if (type == tNull)
return thi... |
d6d77e06-7207-4b25-89a6-f7e56f27bb24 | 1 | public void broadcastAction(String sender, String message) {
String action = PacketCreator.action(sender, name, message);
for (Client c : getClients()) {
c.send(action);
}
} |
3b7ba370-470d-456e-86a8-5f3de15911e7 | 8 | private void boxOperationsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boxOperationsActionPerformed
OperationType operationType = this.getOperation();
if (OperationType.COMPLEMENT.equals(operationType)
|| OperationType.EXPONENTIATION.equals(operationType)
... |
89610527-4c71-4a9a-8639-4c1047b6eb8c | 3 | public TrayIconBasic() {
if (!SystemTray.isSupported()) {
// Go directory to the task;
return;
}
//Image icon = Toolkit.getDefaultToolkit().getImage("");
Image icon = createIcon("/Images/fb.png", "NSYNC File Sharing");
if (icon == null) {
... |
fdc3c48c-7701-4b29-bdca-cd7219022373 | 0 | public static void main(String[] args) {
System.out.println(1 + 2 * 3); // 7
System.out.println((1 + 2) * 3); // 9
System.out.println(1 + (2 * 3)); // 7
} |
43448da2-5658-4bec-89bf-10c0af24f173 | 0 | public int getNbLigne() {
return nbLigne;
} |
004545ba-431a-43e6-b5d9-a68aa88b37dd | 5 | public void setId( int id )
{
if( sp != null )
{
sp.setId( id ); // embedded blip/pict
}
else if( pic != null )
{
pic.setId( id ); // embedded image
}
else if( graphicFrame != null )
{
graphicFrame.setId( id ); // chart
}
else if( cxnSp != null )
{
cxnSp.setId( id );
}
el... |
4bc32c56-9c36-497a-a22b-1e3fea254eda | 5 | protected static String[] getOldCommitUrns( File target ) throws IOException {
if( !target.exists() ) return EMPTY_STRING_ARRAY;
File commitListFile = commitListFile( target );
if( !commitListFile.exists() ) return EMPTY_STRING_ARRAY;
ArrayList<String> urns = new ArrayList<String>();
BufferedReader r = new Bu... |
af626e66-1db9-437b-b867-bd32d750b58a | 8 | public static void enterProfile() throws FileNotFoundException {
System.out.print("\nEnter username: ");
String u = sc.nextLine();
boolean newProfileMade = false;
while (!checkUsername(u)) {
System.out.println("Username not found...");
System.out.print("Try again(T)? or Create profile(C)? ");
String te... |
8a6359c0-db65-4b35-b370-5031d59388c1 | 3 | private boolean escribirCuenta (int i,CCuenta cuenta){
if(i>=0 && i<= nregs){
try{
archivo.seek(i*tam); //situamos el puntero en la posición que me indica i
archivo.writeUTF(cuenta.getConcepto());
archivo.writeFloat(cuenta.getDebe());
... |
1563f28a-64db-477b-99e9-b5122508f45e | 3 | @Override
public boolean onMouseDown(int mX, int mY, int button) {
if(super.onMouseDown(mX, mY, button)) {
return true;
}
if(input.onMouseDown(mX, mY, button) || display.onMouseDown(mX, mY, button)) {
return true;
}
return false;
... |
7a42848a-3733-49bb-8e5f-ac43c9684fba | 5 | private void loadSize(){
FileInputStream in;
File settings = new File("settings.properties");
if(settings.exists()){
try {
in = new FileInputStream("settings.properties");
Properties prop = new Properties();
try {
prop.load(in);
in.close();
if (prop.containsKey("windowwidth") &... |
07a8d5b0-0a60-4a90-a203-93dbf3518294 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jtfUserName || e.getSource() == jpfPassword
|| e.getSource() == ensure) {
if (jtfUserName.getText().equals("")
|| jpfPassword.getPassword().length == 0) {
JOptionPane.showMessageDialog(null, "请输入用户名密码!", "提示",
JOptionPa... |
198d872b-8e76-4f5b-bc4a-e8b15640eba9 | 2 | public static void addListenerToItems(JMenu menu, ActionListener listener) {
for (int i = 0; i < menu.getItemCount(); i++) {
JMenuItem jmi = menu.getItem(i);
if (jmi != null)
jmi.addActionListener(listener);
}
} |
ca48bfe5-e061-46bf-b97a-e9d68f37bb04 | 9 | private Object makeNodeArray(Field f, EBlock b, int maxBlocks, int depth, AsnNodeCallBack directCb) {
ArrayList<EBlock> subBlocks = b.getSubBlocks(EBlock.MAX_BLOCKS, f.type.blockSize, f.type.paddingByte);
ArrayList list = new ArrayList(subBlocks.size());
if (f.isReference()) { // Heterogeneous... |
3b14fbff-9d7d-4d6b-8698-eb5eb48c9e64 | 9 | public WorkManager(WorkType workType) {
pipeManager = new PipeManager<WorkEntry<? extends Work>>();
pipeManager.init(workType);
this.workType = workType;
List<Pipe<WorkEntry<? extends Work>>> pipes = pipeManager.getAvailablePipes(workType);
m_threadPool = Executors.newFixedThr... |
a50feec1-7bbf-4dd0-afdc-c58fbfe1f8df | 2 | public static void main(String[] args){
int sum=0;
for(int i=0;i<1e6;i++){
if(isDoublePalindrome(i)){
sum+=i;
}
}
System.out.println(sum);
} |
6f265ef0-1449-428e-92a0-a14e29754d37 | 9 | public void loadSettings() {
GameApplication.engineLogger.info("Loading game settings...");
GameDataFile data = new GameDataFile(settingsFile, true);
if (data.isReady) {
Map<String, String> content = data.getData();
isParticlesActivated = Boolean.valueOf(content.get("pa... |
552904ab-b68c-4a50-95d6-c9cedb6efed7 | 1 | public List<MenuElement> getChildren() {
if (this.children == null) {
return new ArrayList<MenuElement>();
}
return this.children;
} |
654d4f2d-7d97-4d2e-b592-9f13b944ec93 | 4 | private void buttonSaveFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveFileActionPerformed
// Checks wether a file is selected or not
if (!textFieldFilePath.getText().isEmpty()) {
// Checks wether a task has been selected
// -1 is the equivalent... |
6f8c9be1-1a43-47e0-81cb-f86566bc09f1 | 8 | public static String decode(String[] dictionary, String message) {
int count = 0;
int index=0;
StringBuilder result = new StringBuilder();
for(int i = 0; i < dictionary.length; i++){
Pattern p = Pattern.compile(dictionary[i]);
Matcher m = p.matcher( message );
count = 0;
while (m.find()) {
count... |
46cbf2c3-1a10-4c88-bf5a-cc2b1ebf6cc8 | 2 | @Override
public int compareTo(ValueIndexPair o) {
return sum < o.sum ? -1 : (sum > o.sum ? 1 : 0);
} |
9c04188a-42b6-40bd-9159-f176888233d3 | 0 | @Override
public String getDesc() {
return "Heal";
} |
b2b29c3d-add7-4348-8bac-9d58d653c318 | 2 | public void putAll(Map<? extends K, ? extends V> m) {
synchronized (lock) {
HashMap<K, V> _map = new HashMap<K, V>(map);
_map.putAll(m);
map = _map;
}
} |
584b346c-b853-4825-85c5-33bbb35366a8 | 6 | private static final boolean useItem(final MapleClient c, final int id) {
if (InventoryConstants.isUse(id)) { // TO prevent caching of everything, waste of mem
final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
final byte consumeval = ii.isConsumeOnPickup... |
1959fbe8-f275-45cb-8434-180e4b47ceee | 8 | private void botonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonActionPerformed
// TODO add your handling code here:
try {
if (nombre.getText().length() != 0 && nombre.getText().length() < 31 && celular.getText().length() == 10 || nombre.getText().length() != 0 && n... |
87173514-9ca1-4031-ac90-5a9cc66ae6b6 | 7 | public void loadIndex(File f[])
{
index = new Vector<Price>();
Parameter param = Parameter.getInstance();
String datefmt = param.getParam("index date format");
if (datefmt == null)
{
System.err.println("ERROR: Please specify date format");
System.exit(1);
}
String separator = param.getParam("in... |
3f070f64-21c7-4155-a49e-e5cf703dfcd2 | 0 | private Connection createConnection() throws Exception {
//Logger.global.info("Creating a new database connection in the pool.");
Class.forName(DRIVER_NAME).newInstance();
Connection conn = DriverManager.getConnection(DATABASE_URL, DATABASE_USERNAME, DATABASE_PASSWORD);
conn.setAutoCommit(false);
re... |
031eab0f-f14f-498b-b78e-965b0759382f | 6 | public void convert(Montant valDep) {
double val = valDep.getValeur();
Unite unit = valDep.getUnite();
Conversion conv = unit.getConv();
/* the methods will change depending on the type of conversion
* first step of the conversion : ... |
3e7fac3a-62cf-4233-9bbc-8e5388d42876 | 0 | public Grid(HashMap<Character, Vehicle> vehicles, int gridSize, ArrayList<Grid> previousGrids) {
this.vehicles = vehicles;
this.gridSize = gridSize;
this.previousGrids = previousGrids;
} |
da0ec8bd-74db-4735-a923-1511aeec35d1 | 5 | protected boolean setPlayer2Score(int score) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setPlayer2Score() BEGIN");
}
if (score < 0) {
throw new IllegalArgumentException(
"Game::AddPlayer2Score - Invalid integer(" + score
+ ") to a... |
d3c89eb0-e640-4356-a59d-a18dcfaee06c | 6 | public void setBlockCheck(int x, int y, int z, byte b)
{
if (x < 0 || x >= 16)
return;
if (z < 0 || z >= 16)
return;
if (y < 0 || y >= MAP_HEIGHT)
return;
blocks[z + x * 16 + y * 256] = b;
} |
6d652c03-fe64-4d45-9f97-a24116f72d77 | 0 | public static void main(String[] args) {
first : {
System.out.print("Hello, ");
here : System.out.println("World!");
}
} |
f4383441-fac2-4a98-b838-5716f8c6be22 | 6 | @Override
public double[] computeValue(char refBase, FastaWindow window,
AlignmentColumn col) {
int startPos = Math.max(window.indexOfLeftEdge(), col.getCurrentPosition()-WINDOW_SIZE);
int endPos = Math.min(window.indexOfRightEdge(), col.getCurrentPosition()+WINDOW_SIZE);
counts[0] = 0.0;
counts[1] = 0.0;
... |
7a0537dc-a65a-4ec9-adcc-949f48250327 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Competence other = (Competence) obj;
if (!Objects.equals(this.m_nomComp, other.m_nomComp)) {
... |
a17eda26-c156-400b-9282-9f6c06857d53 | 3 | private void btnBackupNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBackupNowActionPerformed
String backupPath = Controller.getProperty(ApplicationProperties.BACKUP_PATH);
if (backupPath == null || "".equals(backupPath)) {
final int selected = sharedFileChooser.showDirectoryChooser(... |
a35f0b41-d7c9-4934-b594-b7a018c5aa0a | 8 | public void ApplyVulnerablePHPFile(DatabaseAccess JavaDBAccess, int VULNERABILITY_INJECTION_RESULTS_ID) {
PreparedStatement ps = null;
String diffFile = "";
String PHPFileText; //The text of the PHP file where we want to inject the vulnerabilities
Connection conn = null;
String ... |
56ff6958-f66c-418e-ba5d-a54fa122dfbe | 9 | public synchronized void init() {
if (inited) {
return;
}
// shading dictionary
if (shading == null) {
shading = library.getDictionary(entries, "Shading");
}
shadingType = library.getInt(shading, "ShadingType");
bBox = library.getRectang... |
ee0c301b-0e28-4a59-b47f-f1aa028072f7 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
... |
5d1828be-508c-4504-95d7-ce1ff15c6cf9 | 2 | private double search() {
double l=mu-sigma*2;
double r=mu+sigma*2;
while (l+0.1<r){
double t1=(r-l)/3+l;
double t2=2*(r-l)/3+l;
if(f(t1) < f(t2))
l=t1;
else r=t2;
}
return (l+r)/2;
} |
87a72cd5-4ad0-46b6-b053-f780a205e4cf | 3 | public static void updateRed() {
for (int i = 0; i < rOrgs.size(); i++) {
Organism g1 = rOrgs.get(i);
g1.move();
for (int j = i + 1; j < rOrgs.size(); j++) {
Organism g2 = rOrgs.get(j);
if (g1.getDist(g2) < 40) {
g1.closeTo(g2);
}
}
}
} |
7aaba534-3a97-4340-966d-5f593ca9cd89 | 1 | public void testWithFieldAdded3() {
Period test = new Period(0, 0, 0, 0, 5, 6, 7, 8, PeriodType.time());
try {
test.withFieldAdded(DurationFieldType.years(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
aff0f789-5d8d-4c42-a76d-68b9e69cd74b | 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... |
c5af00b2-53ad-4c5a-87fe-5581cd2867f8 | 8 | @Test
public void testRestoreAndEquals() {
Map<String, Object> phoneDescription = new HashMap<String, Object>();
phoneDescription.put("name", "3Gs");
phoneDescription.put("brandName", "Apple");
phoneDescription.put("screenSize", 5);
phoneDescription.put("screenType", ScreenType.RESISTIV);
phoneDescription.... |
d52acaf1-e40f-4302-a9f4-34eb93248a03 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(GO)) {
go(false);
} else if (e.getActionCommand().equals(GOTO_LINE_AND_COLUMN)) {
go(true);
} else if (e.getActionCommand().equals(CANCEL)) {
cancel();
}
} |
0f51cf79-8b94-4c8d-b5d7-91d42718959c | 4 | public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) {
BigDecimal opt = null;
do {
try {
final String val = ConsoleMenu.getString(title + " (default:" + defaultValue + ")", null);
if (val.length() == 0) {
... |
99bc4e66-5412-4469-9ad9-2c9c6d2a3d21 | 4 | public void draw(Graphics g){
int x = getX();
int y = getY();
int w = getW();
int h = getH();
int xPoints[] = {x, x + w/2, x+w, x + w/2};
int yPoints[] = {y, y + h, y, y - h};
int xPoints1[] = {x+4, x+4 + w/2, x+4+w, x+4 + w/2};
int yPoints1[] = {y+4, y+4 + h, y+4, y+4 - h};
if(w < 0){... |
26d7a8a1-d67a-47a0-9f3d-b81886d8baf1 | 3 | public void openBraceNoIndent() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) {
print(currentLine.length() > 0 ? " {" : "{");
println();
} else {
if (currentLine.length() > 0)
println();
println("{");
}
} |
8229dc4b-8b19-42e6-84f8-5916bab5ae7a | 0 | public void updateTotalMatches() {
totalMatches.setText(new StringBuffer().append(TOTAL_MATCHES).append(model.size()).toString());
} |
d7881da2-0f20-4528-a1f9-9181dfa12033 | 4 | public void guiForMainHomePage() {
frmMainHomePage.setSize(500, 400);
frmMainHomePage.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmMainHomePage.setVisible(true);
frmMainHomePage.add(pnlMainHomePage);
frmMainHomePage.setLocationRelativeTo(null);
frmMainHomePage.setTitle("XML Tool");
pnlMainHomePage... |
dc7ce219-1f9e-4f8f-badd-f38ee24a7583 | 2 | public void loadObjectives()
{
String input ="savedata/"+idString+".objectives";
try
{
BufferedReader in = new BufferedReader(new FileReader(input));
String test=in.readLine();
for(int i=0; i<objectiveComplete.length; i++)
{
objectiveComplete[i]=Boolean.parseBoolean(in.readLine());
}
}
... |
73bcef1b-b0f1-4c04-b67f-2a791ccb3f3e | 2 | public Tuote haeTuote(int id) throws DAOPoikkeus {
Tuote tuote = new Tuote();
// avataan yhteys
Connection yhteys = avaaYhteys();
try {
// Haetaan tietokannasta ostoskoriin jokin tietty tuote
String tuoteQuery = "select nimi, numero, hinta, tuoteID from Tuote where tuoteID=?";
PreparedStat... |
eee0f767-4cfb-45a5-af7a-3bd997a845b8 | 4 | public void storeForm(int userId, Form form) throws SerialError, ErrorStoringFormException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(baos);
oout.writeObject(form);
oout.close();
S... |
2a95e9fe-7f37-4cc2-bb3d-95c81e86c818 | 0 | public Integer interpret(Context ctx) {
return left.interpret(ctx) - right.interpret(ctx);
} |
5ea5c6bf-418c-4182-bb43-26af4922468a | 6 | protected URL buildURL(String code, String[] variables) throws APIException, MalformedURLException {
StringBuilder path = new StringBuilder(67);
path.append("/?uid=");
path.append(this.uid);
path.append("&ssid=");
path.append(this.ssid);
path.append("&code=");
path.append(code);
path.append("&variable="... |
4c43737c-ecca-46b4-9698-de4fdb914359 | 3 | private PDFObject readArray(
ByteBuffer buf, int objNum, int objGen, PDFDecrypter decrypter) throws IOException {
// we've already read the [. Now read objects until ]
ArrayList<PDFObject> ary = new ArrayList<PDFObject>();
PDFObject obj;
while((obj= readObject(buf, objNum, objGen, ... |
f959a098-d8ec-4072-b121-2d1db87e9f58 | 0 | public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
} |
df9c72fc-6ec6-4010-a493-700180462010 | 2 | public void setSuperflippedState() {
String[] face = {"F", "R", "B", "L", "U", "D"};
Color [] color = new Color[6];
setSolvedState();
for(int i=0;i<6;i++) {
color[i] = rubiks.getColor(face[i]+":1:1");
}
for(int i=0;i<6;i++) { //Loop for each face
rubiks.setColor(face[i]+":1:2", ... |
d08a8d89-0ad0-4fb6-b4b2-7c6fd5bcc286 | 8 | public vector2d goToAim(vector2d aim) {
vector2d value = new vector2d(0, 0);
if (this.type != 0) {// zrobic opcje dla wszystkich
return value;
}
double d;
if (aim.getX() < 0 && aim.getY() < 0) {
if (aims == null || indexAims == -1) {
retur... |
21fdd664-552e-4ad0-9ded-649bacffd1a7 | 8 | public HttpConnection(HttpListener listener,
InetAddress remoteAddr,
InputStream in,
OutputStream out,
Object connection)
{
if(log.isDebugEnabled())log.debug("new HttpConnection: "+connection);
_l... |
59d76389-9924-4bed-8ee4-40aede67b159 | 7 | protected double meanOrMode(Instances instances,
int[] instList,
int attIndex) {
double result, found;
int[] counts;
int numInst = instList.length;
if (instances.attribute(attIndex).isNumeric()) {
result = found = 0;
for (int j = 0; j < numInst; j++) {
Instance currInst = i... |
34224429-41f8-4831-ac63-36226379bc93 | 0 | public void insertResult(int index, FindReplaceResult result) {
results.add(index, result);
} |
56a90473-d9bc-4575-8138-81a2c0d64fa6 | 8 | public XmlReader() {
// (1)得到 DOM 解析器的工厂实例
DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
try {
// (2)从 DOM 工厂获得 DOM 解析器
DocumentBuilder domBuilder = domfac.newDocumentBuilder();
// (3)把要解析的 XML 文档转化为输入流,以便 DOM 解析器解析它
InputStream is = new FileInputStream(new File("doctest.xml"))... |
e5476201-3e75-4ab5-b8da-7ce842bcffda | 5 | private Integer pickBookingInList(List<Booking> list) {
String input = null;
while (true) {
System.out.println("Select an item in the following list :");
Integer i = 1;
for (Booking b : list) {
System.out.println(" " + (i++) + " "
... |
f4dab114-82c0-48c9-99e8-d225aeba8d10 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Email other = (Email) obj;
if (this.Id != other.Id) {
return false;
}
if (!Ob... |
7c39af82-5196-44b7-9624-f364317e10ac | 5 | public boolean checkGoal(State state) {
for (int k = 0; k < state.getData().size(); k++) {
for(int m = 0; m < state.getData().get(k).size(); m++) {
if (state.getData().get(k).get(m).equals("$") || state.getData().get(k).get(m).equals(".")) {
return false;
}
}
}
endTime = System.nanoTime();
... |
c239d347-066f-4e7b-81d5-03ca877def8b | 4 | protected boolean isRegisterKeyword(String token) {
if (token.endsWith(",") && token.length() != 0) {
Object o = registersKeywords.get(token.substring(0,
token.length()-1).toLowerCase());
return o == null ? false : true;
} else {
Object o = registersKeywords.get(token.toLowerCase());
return o == nu... |
ec0036e4-f4af-4d28-87bf-0dd1ba667d2b | 1 | public void setCommandButtonFontsize(int fontsize) {
if (fontsize <= 0) {
this.buttonComFontSize = UIFontInits.COMBUTTON.getSize();
} else {
this.buttonComFontSize = fontsize;
}
somethingChanged();
} |
6f5cd554-7fcc-4ece-b564-21fb2e968c8b | 0 | public boolean contains(String key) {
return get(key) != null;
} |
5b97e4c4-9e61-4d3f-83d9-0b098101d49f | 1 | @Override
public List<Integer> save(List<Description> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Description bean) -> {
Object[] objects = new Object[1];
... |
50f4e8b9-14e8-4dcc-8c6a-d36dbfe8cded | 7 | public String getResponseString(String url) {
String lineText;
StringBuilder sb = new StringBuilder();
InputStreamReader isr = null;
int failCount = 0;
do {
try {
getMethod.setURI(new URI(url));
HttpResponse response = httpClient.execute(getMethod);
int status = response.getStatusLine().getStat... |
81122f16-25ce-4ca1-8734-9fe4cd0eb67d | 4 | public Move chooseMove(State s) {
// remember who we are so we can correctly evaluate states
me = s.whoseTurn();
int myBoundary = -10000;
// The rest of this function looks a lot like evalMove, except
// that it doesn't just track the minimaxvalue, but also the
// best move itself.
// get a list of possi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.