method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
12f15462-5501-48b6-94ba-01021500bfb6 | 1 | public void setId(int id) throws ParkingException {
if (id < 0) {
throw new ParkingException("Id is under zero");
}
this.id = id;
} |
1ca89760-691e-4d71-98ec-db584b328704 | 2 | private ConfigManager() {
m_props = new Properties();
try {
m_props.load(this.getClass().getClassLoader()
.getResourceAsStream("config.property"));
} catch (FileNotFoundException e) {
getLogger().error(e.getMessage());
e.printStackTrace();
} catch (IOException e) {
getLogger().error(e.getMess... |
53044987-437e-4bbc-835b-2f5cdbcf96e5 | 0 | public boolean isAlive()
{
return alive;
} |
1ce764e2-db1f-452a-a619-7dbdbef1e825 | 1 | @Test
public void tosiPieniEsteOikealla() {
laitetaasPariPientaEstetta();
t.lisaaEste(new Este(0, 92, 1000, 200));
pe.liikuOikealle();
for (int i = 0; i < 100; i++) {
pe.eksistoi();
}
assertTrue("Hahmo ei päässyt matalan esteen yli. x = "
... |
61d35633-0ece-47ce-bada-d9f5fc3d8fa2 | 4 | public String getRoomNameInDirection(String direction) {
switch (direction.toLowerCase()) {
case "north":
return this.north[0];
case "east":
return this.east[0];
case "south":
return this.south[0];
case "west":
... |
8c657ba4-fdfd-4c87-b144-b355bac7c608 | 9 | public void successResponseReceived(String localAddress,
String remoteAddress, int remotePort, Codec codec) {
switch (userAgent.getMediaMode()) {
case captureAndPlayback:
//TODO this could be optimized, create captureRtpSender at stack init
// and just retrieve it... |
1915aefe-f472-472e-b3e2-c10c70ab74ec | 4 | public void moveRight(Area currentWorld){
for(int count = stats.speed; count > 0; count--){
if(currentWorld.locWalkable(x + size + 1, y)
&& currentWorld.locWalkable(x + size + 1, y + size)
&& currentWorld.locWalkable(x + size + 1, y - size)){
x++;
}
}
} |
cd4b911f-01b5-4727-bbc6-e630cb9ff14f | 4 | public Object getValueAt(int rowIndex, int columnIndex) {
switch(columnIndex){
case 0:
return pers[rowIndex].getNom();
case 1:
return pers[rowIndex].getNaissance();
case 2:
return pers[rowIndex].isMasculin();
case 3:... |
7dc9caef-14b7-469a-813c-e03fcfa15f83 | 9 | public void runTest(File f, AI ai, AI ai2) throws FileNotFoundException,
UnsupportedEncodingException,
IOException {
FileWriter out = new FileWriter(f, true);
int wins = 0;
int ties = 0;
int loss = 0;
for (int g = 0; g < numGames; g++) {
doubl... |
7a242585-fa4e-408d-83a8-0fee4b345f5f | 8 | public String replaceObfuscation() {
String replaceObfuscatedCode = null;
/*
* 難読化に使用する文字の個数を乱数で決める。
* 個数は必ず4以上とする。
*/
int keyCharacterNumber = keyCharacterList.size();
int quantyKeyCharacter = 0;
Random random = new Random();
while (true) {
quantyKeyCharacter = random.nextInt(keyCharacterNumbe... |
e53fa858-1bf3-427d-807b-4809e50bf734 | 7 | public void addInstance(GuideDecision decision) throws MaltChainedException {
if (decision instanceof SingleDecision) {
throw new GuideException("A branched decision model expect more than one decisions. ");
}
featureModel.update();
final SingleDecision singleDecision = ((MultipleDecision)decision).getSingle... |
4ced2c1f-48fe-4a16-97b1-906abfea5bb0 | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
aca78c89-2aa4-4e06-90f5-c8576ad325d6 | 1 | @Override
public void onEnable() {
// 1.0.0.0 <-- Dev #
// 1.0.0 <-- Hotfix #
// 1.0 <-- Sub Version #
// 1 <-- Version #
if (DEBUG) {
NAME = "Cops And Robbers INDEV V1.0.0.1";
} else {
NAME = "Cops And Robbers v1.0.0";
}
// plugin enable stuff
getLogger().info(NAME + " is enabled!");
ge... |
60d28951-8b0c-45c9-b824-423474347efe | 9 | @Override
public void caseAIfStmt(AIfStmt node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(If");
inAIfStmt(node);
if(node.getIf() != null)
{
node.getIf().apply(this);
}
if(node.getLPar() != null... |
58303638-42dc-4f84-a278-4f764df8c93f | 2 | public byte [] recvInterrupt ()
throws IOException
{
if ("interrupt" != getType ())
throw new IllegalArgumentException ();
if (spi == null)
spi = iface.getDevice ().getSPI ();
// FIXME getInterval() ms timeout (caller guarantees periodicity)
return spi.readIntr (getU8 (2), getMaxPacketSize ());
... |
bae18194-c5fb-44da-b7f9-9b7b7b2134fd | 8 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == left)
{
halign = Alignment.LEFT;
return;
}
if (e.getSource() == center)
{
halign = Alignment.CENTER;
return;
}
if (e.getSource() == right)
{
halign = Alignment.RIGHT;
return;
}
if (e.getSourc... |
77c6fb76-c27e-4684-8c3c-17561b3721f3 | 0 | public JSONWriter endObject() throws JSONException {
return this.end('k', '}');
} |
73a68078-189f-4fb5-9084-60dade71cf81 | 3 | private void traiterFichier (File fichier)
{
int b = -1;
boolean pasFini = true;
try
{
//transfert en binaire
BufferedInputStream in = new BufferedInputStream(new FileInputStream(fichier));
BufferedOutputStream out = ne... |
e73468be-8f9d-4a1f-8c90-e1d7221d8031 | 2 | public static float findMinimum(Collection<Float> values) {
float MIN = Float.POSITIVE_INFINITY;
for (float f : values)
if (f < MIN)
MIN = f;
return MIN;
} |
e3e20bdc-e064-4f5c-8b97-25ca9cf1a384 | 4 | public void print(){
for(int k=0;k<=cols;k++){
System.out.print(vnames[k]+"\t");
}
System.out.print("\n");
for(int k=0;k<=cols;k++){
System.out.print(vunits[k]+"\t");
}
System.out.print("\n");
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
System.out.print(vls[i][j]+"\t");
}
System.o... |
d2471286-2ba9-433d-b643-b447321869ef | 7 | public String readLine() //exclusively for NON-token
{
if(console)
{
try
{
return myInFile.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
... |
e9e421ec-4cba-45d2-aad6-e92218d55e60 | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
1b2ac622-de8e-4a33-bdbb-13ee0d2d6f9d | 9 | public void run() {
int nf = 1;
int df = 1;
int n2, d2;
for(int n = 1; n < 100; n++) {
for(int d = n + 1; d < 100; d++) {
for(int i = 0; i < 10; i++) {
if(n == d || (n % 10 == 0 && d % 10 == 0)) {
continue;
... |
67f9a1e4-0f94-44cc-aa7d-21db69cbdaa4 | 8 | @Test
public void testAddWhileQuery1() {
Bag<Integer> myList = new Bag<Integer>();
myList.add(1);
myList.add(2);
myList.reset();
assertTrue(myList.hasNext());
int x = myList.next();
assertTrue(x == 1 || x == 2);
myList.add(3);
assertTrue(myList.hasNext());
int y = myList.next();
assertTrue(... |
d7a631cc-c3bf-4438-8d3c-9a8aee67db3b | 7 | public boolean isCorner(String m[]){
String rows[] = {"row1", "row3"};
String cols[] = {"0", "2"};
if(m[0] == null)
return false;
if(m[0].equals("row2") && m[1].equals("1")){
//center square
return false;
}
for(int i=0; i< rows.length; i++){
for(int j=0; j<cols.length; j++){
... |
f608106a-ed93-4b12-bc4e-b6a65188f54e | 0 | public int getSouth(){
return this.south;
} |
aa7c6864-0a24-4174-a783-64c5381f855f | 0 | @Override
public void windowOpened(WindowEvent arg0)
{
} |
6bfd4934-1218-4f5d-9692-8ddf1b9b1537 | 0 | @Override
public String getTmp() {return tmp;} |
367b7bb1-4aae-4e71-a312-be6c3b9d2cfc | 6 | public ArrayList<ArrayList<Integer>> threeSum(int[] num) {
Arrays.sort(num);
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
Set set = new HashSet();
for (int i = 0; i < num.length; i++) {
if (i < 0)
break;
int left =... |
4f63b52c-e351-451e-b3c2-9351928995e1 | 0 | @Test
public void testPercentageUpdate() throws Exception {
propertyChangeSupport.firePropertyChange(DialogWindowController.PERCENTAGE, 0, 10);
assertEquals(view.getProgressBar().getValue(), 10);
} |
b152a921-f7bc-4dd8-9ee4-052c22e9f0b6 | 6 | @Override
public void execute(Joueur jou){
Joueur proprio = this.getProprietaire();
if(proprio == null){
propositionAchat(jou);
}
else if(proprio == jou && getRanking() < 5 && jou.possede(this.groupePropriete)){
propositionAmeliorat... |
ac56c7b2-c7df-4f87-9056-0db3568b76bd | 8 | private String getLabelForState(IEntity entity) throws IOException {
final DrawFile cFile = entity.getImageFile();
final String stateBgcolor = getBackColorOfEntity(entity);
final String stereotype = entity.getStereotype() == null ? null : entity.getStereotype().getLabel();
final StringBuilder sb = new StringB... |
52e8c7af-d853-44ef-a894-b2ffa745e4df | 2 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
if (!this.isEmptyTable(tableSetUp) && this.txtnamefile.getText().length() != 0) {
this.getDataTable(tableSetUp);
this.datacompiler ... |
52eaaa38-07d8-402e-ac84-3a6e7731c6a2 | 8 | public String monthInLetters(String field)
{
String newField = "";
if(field.length() > 2)
{
newField = String.valueOf(getMonth(field.substring(0, 3)));
System.out.println("month : " + getMonth(field.substring(0, 3)));
if(field.length() > 3)
... |
da2042d8-6290-4466-a801-fc4e88040de6 | 1 | public String getManifestMainAttribute(Attributes.Name name,
String defaultValue)
{
Attributes atts = _manifest.getMainAttributes();
Object value = atts.get(name);
return value != null ? value.toString() : defaultValue;
} |
77933a88-ecb6-424f-aeaf-69925e1ad8ac | 7 | public static boolean modificar(Recurso r) throws SQLException {
String queryRecurso = "UPDATE recurso SET isbn = ?, titulo = ?, fecha = ?, genero = ?,"
+ "num_ejemplar = ?, estado_conserva = ?, disponibilidad = ? WHERE id = ?";
String queryLibro = "UPDATE recurso_libro SET autor = ?, e... |
c6d72ecb-b775-4aac-9206-5f5088bc2b9b | 0 | protected CommandManager(PrintStream commandSender, int verbose) {
this.commandSender = commandSender;
this.verbose = verbose;
} |
2d4021a0-0f66-4eeb-9acc-9e8ed4df2902 | 0 | public accept()
{
this.requireLogin = true;
this.addParamConstraint("id", ParamCons.INTEGER);
this.addRtnCode(405, "appointment not found");
this.addRtnCode(406, "illegal time");
this.addRtnCode(407, "user not waiting");
} |
ea2f873a-63b7-4725-8a9a-5844324f6d93 | 4 | private void btnRemoveTaskFromProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveTaskFromProjectActionPerformed
selectedTask = (Task)listTasksList.getSelectedValue();
if(selectedTask !=null && selectedElement !=null && selectedProject !=null && selectedAsset !=null)
... |
cedb68ff-f417-4cd5-9b30-5f22b8d78403 | 6 | public void placeFlags(){
// Place random flags
Random randX = new Random();
Random randY = new Random();
int x, y;
for( int r = 0; r < NUM_OBJECTS; r++ ){
x = randX.nextInt( 1820 + 1 );
y = randY.nextInt( 980 + 1 );
// Make sure we don't pla... |
af919173-ac46-4d0a-860e-534c203694fe | 4 | private boolean read(){
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", Updater.USER_AGENT);
conn.setDoOutput(true);
final B... |
1e585f29-a6c4-4e76-b519-b207007b1c7b | 7 | public static boolean isPrime(long value){
if(value==2||value==3||value==5){
return true;
}
if(value%6==1||value%6==5){
for(long i=2; i*i<=value; i++){
if(value%i==0){
return false;
}
}
return true;
}
re... |
52db7905-60ed-43af-962a-d1e3860f3ec8 | 4 | private void textProveedorKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textProveedorKeyTyped
// TODO add your handling code here:
if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar()))
{
... |
9f492b84-c0bb-408e-ada2-ac710336e412 | 0 | @Test
public void test_maxGold() {
Pawn p0 = mock(Pawn.class);
Pawn p1 = mock(Pawn.class);
board.removeAllPawns();
assertEquals(board.numberOfPawns(), 0);
board.addPawn(p0);
assertEquals(board.numberOfPawns(), 1);
when(p0.getX()).thenReturn(1);
wh... |
d324d7b4-2f8e-4670-93b2-b074c2d2915d | 5 | public double[] calculateEnergyConsumptionW(SoftwareSystem system, FunctionalRequirement functionalRequirement, SequenceAlternative sequenceAlternative) {
double consumption[] = { 0, 0 };
for (HardwareSet hardwareSet : system.getActuallyUsedHardwareSets())
system.initializeTime(hardwareSet);
system.getActually... |
a9140652-9757-4e0b-ac8b-5808807581d0 | 1 | public void collapseMenu() {
for(int i = 1; i < methodTree.getRowCount(); i++) methodTree.collapseRow(i);
} |
1c5cc9f6-0b49-48fd-a8d8-62ccc0bb4c0a | 6 | public static TagAndURISubModel launchPopupProfil(Component parent,
ProfilesSystemModel profiles) {
String profilName = (String) JOptionPane
.showInputDialog(parent,
"Nouveau profil :\n Veuillez saisir votre nom.",
"Nouveau Profil", JOptionPane.QUESTION_MESSAGE,
new ImageIcon(VitipiMenuCon... |
a0b45ba7-bb96-4406-b9e9-e6c721176f23 | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
4e7d46dd-92b7-4d13-b63f-39f95538d5ce | 3 | @Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String ext = null;
String s = f.getName();
int i = s.lastIndexOf('.');
if (i > 0 && i < s.length() - 1) {
ext = s.substring(i + 1).toLowerCase();
}
System.out.println(ext);
return ext.equals("sfp");
} |
923898ac-b365-42e0-9818-5a77d591f60e | 4 | private void writeBoolList(List<Boolean> boolList) throws IOException {
byte b = 0;
int mask = 0x80;
for (Boolean aBoolList : boolList) {
if (aBoolList)
b |= mask;
mask >>= 1;
if (mask == 0) {
writeByte(b);
mask ... |
bdbb2b76-9129-44aa-a4a9-282a6fcded49 | 1 | public static void main (String[] args) {
final byte[] data = {(byte) 189, (byte) 88, (byte) 128, (byte) 244, (byte) 156, (byte) 41, (byte) 17, (byte) 177,
(byte) 157, (byte) 173, (byte) 195, (byte) 121, (byte) 99, (byte) 111, (byte) 114, (byte) 112 };
final Guid guid1 = new... |
10e79545-fa53-4c34-81fe-a72fa903152c | 7 | public void AnalyseDirectory(String dir){
File F = new File(dir);
String[] fi = F.list();
String of ;
File fil = new File(dir + "/dist/");
if(!fil.exists())
{
fil.mkdir();
}
for(String f : fi)
{
if(new File(f).isDirectory())... |
a7a87be5-ff50-4921-b5b1-93545734d50c | 4 | public synchronized void gridletSubmit(Gridlet gl, boolean ack)
{
// update the current Gridlets in exec list up to this point in time
updateGridletProcessing();
// reset number of PE since at the moment, it is not supported
if (gl.getNumPE() > 1)
{
String... |
4b8154b0-97b8-4807-b25d-acca4203beb2 | 1 | private boolean jj_2_41(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_41(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(40, xla); }
} |
61ef2f56-f740-4243-b5f7-6fe3cf6b3bb3 | 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... |
bc9ecb2e-d8b1-4da1-932b-b0dc10af2dc4 | 9 | @SuppressWarnings("empty-statement")
/**
* This method will generate a SHA-256 Scanner_Checksum of a given file
*
* @param hash - possible values: SHA-1, SHA-256, SHA-512 and MD5
* @param filename - the target filename, we also handle locked files
* @return - the resulting Scanner_Checksum or empty if not possible... |
fb4ff5af-80d7-46c0-83ed-cb8588d2517d | 2 | @Override
public void update(GameContainer gc, int delta) {
// TODO Auto-generated method stub
Vector2 oldPos = position.copy();
Vector2 steeringForce = behavior.calculate();
Vector2 acceleration = steeringForce.divideBy(mass);
velocity.add(acceleration.multiply(delta * MOVEMENT_PER_MS));
velocity.truncate... |
672701ab-0921-45ea-b2cf-7db60719e442 | 2 | public boolean equals(Object other)
{
if (!(other instanceof Location))
return false;
Location otherLoc = (Location) other;
return getRow() == otherLoc.getRow() && getCol() == otherLoc.getCol();
} |
472d9bbf-4344-4ada-af54-6c034fdf5240 | 6 | public void setTrajectory(Rectangle sling, Point releasePoint)
{
// don't update parameters if the ref point and release point are the same
if (_trajSet &&
_ref != null && _ref.equals(getReferencePoint(sling)) &&
_release != null && _release.equals(releasePoint))
... |
dd79b3ff-8e3a-4862-9d84-9328a9ea02fb | 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... |
b7a91930-ef8c-40e9-ad59-1c0b8a74ad25 | 5 | protected void setup() {
System.out.println("This is patient agent called " + getLocalName());
Object[] arg = getArguments();
try {
int preference = 1;
for (Object o : arg) {
if (o.toString().equals("-")) {
preference++;
} else {
preferences.put(Integer.parseInt(o.toString()), preference... |
5199f249-3690-44d1-ad31-dd14417f1942 | 0 | @Test
public void testRemoveRedMarker() {
System.out.println("removeRedMarker");
Cell instance = new Cell(0,0);
instance.addRedMarker(0);
instance.addRedMarker(1);
instance.addRedMarker(2);
instance.addRedMarker(3);
instance.addRedMarker(4);
instance.a... |
6b3fd626-e778-402a-b069-a1e19a2c85b3 | 2 | public static Map loadYamlFromResource(String resource) {
InputStream yamlConfig = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
Yaml yaml = new Yaml();
Map mainYamlMap = (Map) yaml.load(yamlConfig);
Map resultYamlMap = new HashMap();
List<Map>... |
175d72b7-0f0e-48a8-a19f-af619a14c718 | 8 | private void BestMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BestMouseClicked
// TODO add your handling code here:
List<String> s = new Conectar().GetVendedor();
int t = s.size();
boolean b = true;
List<String> names = new ArrayList<>();
for(Str... |
2bb0003c-3d06-4712-9e6b-82d09c82d4bb | 3 | @Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(PropertyFilteringMessageBodyWriter.class);
return classes;
} |
8fcc8fcd-9f04-4561-b954-c37371db814d | 4 | public double getDouble(String key) throws JSONException {
Object o = get(key);
if(o==null) return 0;
try {
if(o instanceof Number){
return ((Number)o).doubleValue();
}else if(o.toString().length()>0){
return Double.valueOf((o.toString()));
}else
... |
46c2ab22-1777-451d-a59c-f539580dd69a | 4 | private static void refresh(Entity entity) {
EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) entity).getHandle().world).tracker.trackedEntities
.get(entity.getEntityId());
if (entry != null) {
EntityPlayer[] players = (EntityPlayer[]) entry.track... |
4c986323-05e9-48d6-b991-08761b2073e4 | 6 | public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException
{
while (this.getLength() > 0 && this.getText(0, 1).equals("0"))
{
super.remove(0, 1);
if (offs > 0)
offs--;
}
super.insertString(offs, p.matcher... |
3afb35c7-d625-41ea-a37b-a132760e4659 | 7 | public String scriptsToString() {
int n = getChoiceCount();
if (n < 1)
return "";
if (scripts == null || scripts.length <= 0)
return "";
StringBuffer sb = new StringBuffer(scripts[0]);
if (getSingleSelection()) {
if (n < 2)
return sb.toString().trim();
for (int i = 1; i < n; i++) {
sb.appe... |
4c18b2a0-3874-4150-aafa-d38f4a457a6e | 3 | static void testHigh()
{
Scanner in = new Scanner(System.in);
Board b = Board.readBoard(in);
ArrayList<Integer> nextPiece = new ArrayList<Integer>();
while(in.hasNextInt())
nextPiece.add(in.nextInt());
Searcher s;
for (int i = 9; i <13; i++){
for(int j= 5; j < i; j++){
s = new Jogger(new Linea... |
37fa43ff-593b-410f-bfe6-fbad555dbaca | 1 | public boolean isKeyPressed(int keyEventKeyCode) {
if(keys.get(keyEventKeyCode) == null) return false;
return keys.get(keyEventKeyCode);
} |
0ae187f7-5aac-4f9b-a79b-c92ddd8b9b26 | 6 | protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
org... |
a47fb8ba-2504-41b4-829b-08e477367c24 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.id == null && other.id != null) || (thi... |
e304e401-83eb-4716-a6f0-3e6e9ad208e2 | 1 | public void setRpcUser(String rpcUser) throws InvalidSettingException {
if (rpcUser != null) {
this.rpcUser = rpcUser;
} else {
throw new InvalidSettingException("Invalid User");
}
} |
d35c789e-aeaf-4725-8761-9fff0b87c7c7 | 5 | private static <A, B, C> State resolvePair2(StatePair lr, Fst<A> left,
Fst<B> rigth, final Map<StatePair, State> chart, Fst<C> intersection) {
if (chart.containsKey(lr)) {
return chart.get(lr);
} else {
boolean isInit = left.isInitial(lr.fst) && rigth.isInitial(lr.snd);
boolean isAccept = left.isAccept(... |
a4e777d6-eb93-4b7b-881e-967896c255bd | 5 | private boolean verificaiton(Socket socket) throws IOException {
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
if (this.protocal == PROTOCAL.NOPROTOCAL) {
return sa.NOPROTOCOL(in, out);
} else if (this.protocal == PROTOCAL.T2) {
return sa.T2(in, out);
} els... |
dcc7735b-ebba-48a6-ab28-156e692b6f01 | 5 | public void mousePressed(MouseEvent event) {
if (!controller.isObject(event.getPoint()) && !event.isControlDown()) {
controller.getCurrentGraph().deselectAll();
} else {
if (controller.checkSelectedObject(event.getPoint())) {
if (event.isControlDown()) {
isDeactive = true;
}
} else {
if (e... |
cb7c5aae-6fd8-4413-8d5f-bff84b83ab4d | 9 | static void Eval_pop(Neuron pop[]) {
int i, j, k;
//int spam2;
//float spam = 0;
int best[] = new int[Config.TOP_NETS];
float pop_average;
float total_fitness = 0.0F;
float the_best = -999999.0F;
String best_name;
Network net = new Network();
Neuron net_pop[] = new Neuron[Config.NUM_H... |
b552fcb6-8ecd-4944-b760-720562389dee | 6 | public String asRegEx() {
StringBuilder sb = new StringBuilder().append("^")
.append(pattern(scheme, SCHEME_REGEX, "(%s):"))
.append(pattern(host, HOST_REGEX, "//(%s)"));
if (host == null || host.pattern().length() > 0) {
sb.append(port == null ? PORT_REGEX : ((port < 0) ? ""
: (":" + port)));
}
... |
4d80f0d1-fd4b-49c7-a578-1b5b7a292b05 | 1 | public List<Tiedote> haeTiedotteet()
throws DAOPoikkeus {
// luodaan tyhjä arraylist tiedotteille
List<Tiedote> tiedotteet = new ArrayList<Tiedote>();
try {
// haetaan tiedotteet tietokannasta
TiedoteDAO tDao = new TiedoteDAO();
... |
6c8ae6a0-3e33-4ec9-bdc1-b8cd315301db | 4 | public static void mate(ArrayList<ParkerPaulChicken> chickens) {
Random chickenGenerator = new Random(); // random number generator for generating chickens
// guard clause - no more chickens or only 1 chicken
if (chickens.isEmpty() || chickens.size() == 1) {
return;
}
... |
71d0d53a-02f7-418c-9362-cd438d27c5aa | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bibliografia other = (Bibliografia) obj;
if (basicaOuNao != other.basicaOuNao)
return false;
if (livro == null) {
if (other.livro != null... |
46db4035-72a6-4dfc-8e11-aca3d710be38 | 8 | public static boolean insert(Object bean) {
String sql;
PreparedStatement stmt=null;
try{
if(bean instanceof Patient){
sql = "INSERT into patients ("+Patient.getTableSchema()+") " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt=conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
... |
b4cf81e3-27b7-4f59-8947-c9a240bac8b0 | 0 | @Override
public void keyReleased(KeyEvent e) {
keys[e.getKeyCode()] = false;
// add key to queue for thread to send
keystr.add("false:"+e.getKeyCode());
} |
b088c371-a5d8-4d2e-8b10-59c95f4d98c3 | 8 | public void reserveSmallConstants(GrowableConstantPool gcp) {
next_instr: for (Iterator iter = instructions.iterator(); iter
.hasNext();) {
Instruction instr = (Instruction) iter.next();
if (instr.getOpcode() == opc_ldc) {
Object constant = instr.getConstant();
if (constant == null)
continue ne... |
8d568818-b6f9-4d96-a562-512188665344 | 8 | public boolean unregisterCommands() {
CommandMap commandMap = getCommandMap();
List<String> toRemove = new ArrayList<String>();
Map<String, org.bukkit.command.Command> knownCommands = ReflectionUtil.getField(commandMap, "knownCommands");
Set<String> aliases = ReflectionUtil.getField(comm... |
9e5225c6-e51e-4fad-b338-01770c884e85 | 9 | protected Object getChildPort(Object edge, boolean source) {
GraphModel model = getModel();
// Contains the parent of the port, eg. the group
Object parent = (source) ? DefaultGraphModel.getSourceVertex(model,
edge) : DefaultGraphModel.getTargetVertex(model, edge);
// Finds a vertex in the group
int c = m... |
5e4dca8e-a8e7-4a49-acc6-7fdce73715dc | 4 | @Test
public void testSocketThreadSetSocketTimeoutEx() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSocketThreadSetSocketTimeoutEx -----");
String client_hash = "";
boolean exception_expected = false;
try {
server1.startThread();
} catch (IOException | Server... |
21c149c8-4540-4282-a91a-2b0141317c6e | 0 | public GraphDrawer getDrawer() {
return drawer;
} |
77a4d397-bcce-4ffe-9ade-6fec37e48946 | 1 | private void postFile(String fileName) throws Exception {
PrintWriter fileWriter = new PrintWriter(fileName);
String str = "";
while ((str = in.readLine()) != null) {
fileWriter.println(str);
}
fileWriter.close();
} |
be3ef078-3e43-42ed-9a4f-eec73464b476 | 6 | public static Object scan(String type, String line) {
Object ret = scanHelper(type, line);
if (ret instanceof Class<?>) {
Class<?> clazz = ((Class<?>)ret).getComponentType();
if (clazz == null) {
clazz = (Class<?>)ret;
}
return Array.newInstance(clazz,0... |
be5b216d-ce5c-483d-896b-7c7fccb53d8b | 7 | private ArrayList<Individual> pickSimilarWithReplace(Population pop, Individual i1, int num) throws Exception {
int r = 0;
for (int i = 0; i < pop.size(); i++) {
if (i1 == pop.getIndividual(i)) {
r = i;
}
}
//modified indexies
ArrayList<In... |
8620cb95-1009-41f3-bd6c-ae38875b4f20 | 2 | private static String executeCreateTableCommand(DataBaseManager dbManager, Command command) {
List<String> args = command.getArgs();
String tableName = args.get(0);
List<String> columnNames = args.subList(1, args.size());
String msg = "";
try {
boolean result = dbMan... |
2f7892e1-ee71-431c-b4a7-53ba9fe35871 | 0 | public File encode(Serializable structure, File file, Map parameters) {
return file;
} |
e6555563-0fd7-4493-9a55-8347d556dd6a | 5 | public static void writeBytesToImage(BufferedImage bimg, byte[] msg, String filename, String key) throws ImageWriteException, IOException {
int w = bimg.getWidth();
int h = bimg.getHeight();
//System.out.println("[Key] " + key);
RC4 prng = new RC4(EncryptionProvider.sha256(key.getByte... |
6a53df3e-68e7-4fa7-8547-fcf17870af90 | 8 | public static void floodfill( int a, int b , char s ){
Queue<Integer> xx = new LinkedList<Integer>();
Queue<Integer> yy = new LinkedList<Integer>();
xx.add(a);
yy.add(b);
v[a][b] = true;
while( !xx.isEmpty() ){
int x = xx.poll();
int y = yy.poll();
m[x][y] = '*';
for (int k = 0; k < dx.length; k... |
dd832caa-fb13-4800-b96b-e1d42ff23726 | 0 | public Ram produkujemyRam(){
return new DDR3();
} |
e217fcf2-577e-4293-b251-d06702ab0ba8 | 5 | public Node<T> deleteNode(T data) {
if (_root == null) {
return null;
}
if (_root.Data == data) {
_root = _root.Next;
return _root;
}
Node<T> temp = _root;
while (temp.Next != null) {
if (temp.Next.Data == data) {
if (temp.Next == _e... |
f07e1460-2491-479c-9630-646910338b6f | 0 | public VertexSet copy() {
VertexSet tmp = new VertexSet();
tmp.addVertexSet(this);
return tmp;
} |
b7e245dd-1821-46d1-938e-fd69823b6e77 | 0 | @Override
public boolean runWithoutCheats() {
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.