method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
703e158f-d833-4d1a-916a-635998a00288 | 2 | public double standardizedAllResponsesRange(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedAllResponsesRange;
} |
a1961682-c983-4223-b84e-d3e67f9182c5 | 1 | private void closeConnection() {
try {
conn.close();
} catch (Exception ex) {
ex.printStackTrace();
}
} |
7f786130-d905-4aaf-aa61-3ce8c680106c | 7 | @Test
public void testNonEmptyGridConfig() {
grid=new Grid("AlpineRescuemap.jpg");
grid.loadConfig(rescue, "occupiedgrid.csv", "AlpineRescuemap.jpg", rescue.getSearcherConfig(), "SOUTH");
for (GridCell cell : grid.getCells()) {
if (cell.getRow() == 20 && cell.getColumn() ==20)
assertTrue(cell.isOccupi... |
50810d4d-a0e5-4395-890c-3298ce0eae77 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
SHOW_ATTRIBUTES = atts.getValue(A_SHOW);
HIDE_ATTRIBUTES = atts.getValue(A_HIDE);
addActionListener(this);
Outliner.documents.addOutlinerDocumentListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} |
755a1743-6c2b-47cd-a9ff-31496182b53d | 6 | @EventHandler
public void CreeperSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCreeperConfig().getDouble("Creeper.Speed.... |
87178b55-6cd0-48df-b3a2-c7b75ac32788 | 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... |
6c4db094-5a35-471a-a8fd-39c9f491ce32 | 7 | public static void main(String[] args) {
System.out.println("controller:seting up");
Scanner scan = new Scanner(System.in);
boolean check = true;
// ---------------
while (check) {
System.out.println("controller:enter you master directory");
StringConstants.MasterDir = scan.next();
System.out.prin... |
0ad76f52-f223-4033-ba90-b2368840eb70 | 7 | protected int[] getWrongEvent(int num, int totalLen){
int[] arr=new int[num];
for(int i=0;i<num;i++){
arr[i]=-1;
}
for(int i=0;i<num;i++){
do{
arr[i]=(int)(Math.random()*totalLen);
if(arr[i]==totalLen){
... |
0f6dfb0d-a846-40e5-a2aa-0846c75a391c | 0 | public void setTitle(String title) {
this.title.set(title);
} |
827971df-1e11-42da-8e1d-c1b39238cdec | 8 | public DefaultMutableTreeNode buildTree() {
DefaultMutableTreeNode root;
DefaultMutableTreeNode grandparent;
DefaultMutableTreeNode parent;
root = new DefaultMutableTreeNode("Sprites");
try {
BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/sprite... |
e5e56491-2b3c-441d-b164-55d9d3788387 | 8 | private Object readArgument(char c) {
switch (c) {
case 'i' :
return readInteger();
case 'h' :
return readBigInteger();
case 'f' :
return readFloat();
case 'd' :
return readDouble();
case 's' :
return readString();
case 'c' :
return readChar();
case 'T' :
return Boolea... |
755c6f90-e686-453b-8f0e-39f0ac4d7aa4 | 8 | public static URLConnection postMultipart(URLConnection conn, Map<String, String> params,
List<Entry<String, InputStream>> files) throws IOException {
if ((params == null || params.size() == 0) && (files == null || files.size() == 0)) { return conn; }
conn.setDoOutput(true);
String boundary = Long.... |
75cdd4d5-f25a-4df5-8979-549c23121ce3 | 8 | int getSouthTweak(int cellId) {
int row = getRow(cellId);
int positionInRow = getPositionInRow(cellId);
if ((row <= 0) || (row >= 5*n)) {
return 0;
} else if (row == n) {
return positionInRow / n;
} else if (row == 2*n) {
return positionInRow /... |
5817f96a-1a41-49d3-a2b7-9943d22b7259 | 8 | static DiagramType getTypeFromArobaseStart(String s) {
if (s.startsWith("@startuml")) {
return UML;
}
if (s.startsWith("@startdot")) {
return DOT;
}
if (s.startsWith("@startjcckit")) {
return JCCKIT;
}
if (s.startsWith("@startditaa")) {
return DITAA;
}
if (s.startsWith("@startproject")) {
... |
c4600a1b-5166-45be-9e22-8814a28a73aa | 9 | public void decodeSecurityParameters(BerDecoder raw_packet,
SnmpMessage msg)
throws BerException {
if (debug) dump("Decode Security Parameters");
/**
* Setup.
*/
SecParametersUsm usmParm = n... |
6657bdb5-5eb7-4a70-8aae-7f8ae556a1cc | 9 | public SafariLauncher(BrowserConfigurationOptions browserOptions, RemoteControlConfiguration configuration, String sessionId, String browserLaunchLocation) {
String mode = browserOptions.get("mode");
if (mode == null) mode = "filebased";
if ("default".equals(mode)) mode = "filebased";
... |
765559f2-c7ef-4584-8f64-5519356b1345 | 4 | public PreferencesDialog(UINew parent) {
this.parent = parent;
this.setTitle("Preferences");
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
//this.setPreferredSize(new Dimension(250, 120));
this.setResizable(false);
this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
setupWindow();
this.pack(... |
f4ea8ec8-1a0c-4bb5-9108-fd2b5a4b0498 | 9 | public static List<Subclasificacion> listaDeSubClasificaciones(String clasificacion) {
ResultSet tr = null;
String select = String.format("SELECT * FROM subclasificacion WHERE idTipoClasificacion ='%s'", clasificacion);
ArrayList<Subclasificacion> listaSubclasificacion = new ArrayList<Subclas... |
ece6580a-b646-404f-85b8-68b84af8ed6a | 8 | public void buildClassifier(Instances insts) throws Exception {
m_NominalToBinary = null;
m_Filter = null;
if (!isPresent())
throw new Exception("liblinear classes not in CLASSPATH!");
// remove instances with missing class
insts = new Instances(insts);
insts.deleteWithMissingClass()... |
c7e120de-ccd9-44a5-b383-562a3f964764 | 8 | private void createActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createActionPerformed
try{
if (nameOutlet.getText().isEmpty()
|| codeOutlet.getText().isEmpty()
|| priceAOutlet.getText().isEmpty()
|| priceBOutlet.getText().isEmpty()) {
JOptionPane.showMessageDialog(... |
6e2b0e27-0495-4c37-95af-e3239abd3d36 | 5 | public void testLogicLargeArrayArraycopy()
{
boolean[] data = new boolean[1000000];
for (int i = 0; i < data.length; i++) {
data[i] = i % 5 == 0;
}
int startPos = 2;
int length = data.length - 2;
LargeArray.setMaxSizeOf32bitArray(1073741824);
Logic... |
b328650f-64f3-4a16-a9bf-6d965f2dd015 | 6 | @org.junit.Test
public void testLineFeedAfterOpening() {
javaCode = "{{{ adasd;{sadadasda;{if(a){dasdasdasd;}{{{{{{{{{}}{{asdadsadda;{{{{}}dadasdasdasd;}}}}{{}}}}}}dadadasdad;}}}}}}}}";
FormatOptions formatOptions = new FormatOptions();
try {
makeTest(formatOptions);
} ca... |
ae4b48c2-69e4-49b1-8e68-4d81fc088e11 | 5 | @Override
public void play()
{
switch( channelType )
{
case SoundSystemConfig.TYPE_NORMAL:
if( clip != null )
{
if( toLoop )
{
clip.stop();
clip.loop( Clip.LOOP_CON... |
4abcece0-2169-48ec-8562-b4e51219c88b | 4 | public static void add(String playername, String type, String data, double x, double y, double z, String worldname, Boolean staff) {
PreparedStatement pst = null;
Connection con = null;
long time = System.currentTimeMillis()/1000; //Unix time
//Checking if they should be logged
if (staff && getConfig.LogOnlyS... |
0ff4095b-8191-4feb-9074-a8cb5b41db98 | 5 | public static void unzipFileIntoDirectory(ZipFile zipFile, File directory) {
Enumeration files = zipFile.entries();
while (files.hasMoreElements()) {
try {
ZipEntry entry = (ZipEntry) files.nextElement();
InputStream inputStream = zipFile.getInputStream(entry)... |
074dd262-1195-44e9-9727-1ebd8a83cd22 | 0 | public static void createIcons() {
// Create a buffered image from the is not property image.
Image isNotPropertyImage = ICON_IS_NOT_PROPERTY.getImage();
BufferedImage isNotImage = new BufferedImage(TRUE_WIDTH, BUTTON_HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics2D gIsNotImage = isNotImage.createGraphics();
... |
3b9be409-b6a2-49e4-95fd-03c6000bcfe5 | 1 | public void _DoValidateLogin(String name, String password) {
try {
// Alert alert = (Alert) pleaseWait();
// display = Display.getDisplay(this);
// display.setCurrent(pleaseWait());
// Authenticate process = new Authenticate(this, name, password);
... |
515a1eac-336a-4ec8-a14a-d7678acbba12 | 3 | void totalNQueensDFS(int level, int n, int[] occ) {
if(level == n) {
++res;return;
}
for (int i = 0; i < n; ++i) {
if (safe(level, i, n, occ)) {
occ[level] = i;
totalNQueensDFS(level + 1, n, occ);
occ[level] = Integer.MIN_VA... |
ccffa3a8-6295-4eee-bb3d-d95208831a84 | 6 | private String getDomainOfNatural(String _recipient) {
String recipient = new String();
//2つの#が含まれていれば,その間の文字列を取り除く
int lastSharpIndex = _recipient.lastIndexOf("#");
if (lastSharpIndex > 0)
recipient = _recipient.substring(lastSharpIndex + 1);
else if (lastSharpIndex < 0)
recipient = _recipient;
else
... |
6146e93c-4fc7-489b-b5bc-858837f7e70f | 4 | public void faceAwayFrom(Hidable other)
{
if (collisionType((Positioned) other)[0] == ApproachFrom.LEFT)
setDirection(Const.left);
if (collisionType((Positioned) other)[0] == ApproachFrom.RIGHT)
setDirection(Const.right);
if (collisionType((Positioned) other)[... |
99101174-8fd7-4ef9-9d49-364462de7a66 | 6 | public String solve() {
String result = "";
double ans1 = (-b + (Math.sqrt(Math.pow(b, 2) - 4*a*c)))/(2*a);
double ans2 = (-b - (Math.sqrt(Math.pow(b, 2) - 4*a*c)))/(2*a);
if (Double.isNaN(ans1) && Double.isNaN(ans2)) {
result = result + "X is an imaginary number" +
"\n" + "Visit this web page to lear... |
c6e06a14-b811-44c7-ab98-52b019421bef | 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 Rechnungsinhalt)) {
return false;
}
Rechnungsinhalt other = (Rechnungsinhalt) object;
if ((this.id == null && o... |
8014bd58-50e9-4088-95b9-9641cc661479 | 0 | @Test
public void runTestServiceLifecycle1() throws IOException {
InfoflowResults res = analyzeAPKFile("Lifecycle_ServiceLifecycle1.apk");
Assert.assertEquals(1, res.size());
} |
65e25bcb-8fbb-45d1-9291-ade5a0ebc724 | 6 | public MainWindowModel(Stage stage) {
final Stage primeStage = this.stage = stage;
Insets insets = new Insets(10, 10, 10, 10);
Insets insideInsets = new Insets(10, 0, 10, 0);
Insets verticalInsets = new Insets(0, 10, 0, 10);
/*
* Setting the menu
*/
Me... |
f8a539c4-7724-4c60-955d-8f74822cef8e | 2 | private void exportFinalScore(){
int[] finalScore = new int[5];
finalScore[0] = player1.getPlusCount();
finalScore[1] = player1.getMinusCount();
finalScore[2] = player1.gettCount();
finalScore[3] = player1.getBallReturned();
finalScore[4] = player1.endlessScore();
... |
efa28bef-d287-46f4-b6f6-c5c97d74aceb | 6 | final <GItem> String _format_(final Iterable<? extends GItem> items, final Converter<GItem, ?> formatter)
throws NullPointerException, IllegalArgumentException {
final Iterator<? extends GItem> iter = items.iterator();
if (!iter.hasNext()) return "";
GItem item = iter.next();
if (iter.hasNext()) {
this.put... |
5a2bf7e9-96e5-4298-9470-a9a9793077db | 1 | public static int registerFrame(EnvironmentFrame frame) {
Environment env = frame.getEnvironment();
environmentToFrame.put(env, frame);
File file = env.getFile();
if (file != null)
fileToFrame.put(getPath(file), frame);
// Adds the listener that changes this object in the event
// that the file of an env... |
21440ce4-e897-4773-85c6-d7b111c2e8b3 | 0 | public void send(OSCPacket aPacket) throws IOException {
byte[] byteArray = aPacket.getByteArray();
DatagramPacket packet =
new DatagramPacket(byteArray, byteArray.length, address, getPort());
getSocket().send(packet);
} |
2a3a829b-3a50-4ddc-8d14-fe94c8e9d818 | 1 | private void add(int i) {
int currentCount = 0;
if (rand.containsKey(i)) {
currentCount = rand.get(i);
}
rand.put(i, currentCount + 1);
} |
d139f54f-e9f2-410f-8b29-9fba40f6e403 | 5 | public ResizeModelFrame()
{
super(Main.mainFrame, "Resize Model", new String[] {"Cancel", "Resize"});
JPanel gridPanel = new JPanel(new GridLayout(3,3));
gridPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 10, 0));
top.setLayout(new GridLayout(2,2));
top.setBorder(BorderFactory.create... |
c6e76a91-46c8-4fe7-a99b-7258a6cdc295 | 3 | private int getLastOnline(ASPlayer data, TableType table) {
switch(table) {
case DAY: return data.lastDay.online;
case WEEK: return data.lastWeek.online;
case MONTH: return data.lastMonth.online;
default: plugin.severe("Invalid Type in getLastOnline");
}
return 0;
} |
a3cf6397-6b80-4563-8742-96b9195f1203 | 5 | public static void callAnnotated(Object o, Class<? extends Annotation> ann, boolean lazy) {
try {
getMethodOfInterest(o, ann).invoke(o);
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
} catch (InvocationTargetException ex) {
throw new Ru... |
7503ca6e-7404-4b93-9877-36b7194a8834 | 1 | public String searchByName(String name) throws Exception {
if (searchingFile(name, "name") == null) {
return null;
}
return searchingFile(name, "name").toString();
} |
1cae34a4-993d-44d0-86e7-cb7a6fabb584 | 8 | public static void main(String a[])
{
if(a.length<4)
{
System.out.println("Command usage: Shutdown <host> <port> <username> <password> (<true/false for reboot> <external command>)");
return;
}
Socket sock=null;
try
{
final StringBuffer msg=new StringBuffer("\033[1z<SHUTDOWN "+a[2]+" "+a[3]);
if... |
a6e90399-1759-4d76-9953-eb0db598a7dc | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
d23024a9-1c03-4150-99b7-a5c7b10e2340 | 6 | public boolean printMenu() {
System.out.println("=====================================");
System.out.println("1 - Start new game");
System.out.println("2 - Select an opponent");
System.out.println("3 - Complete a move");
System.out.println("4 - Determine if there is a winner or if game is not winnable");
Sy... |
3683b744-469b-4705-b852-8ac59a463771 | 2 | @Override
public void persistChanges() {
for (NoteEntity noteEntity : noteList) {
boolean writeSuccessful = this.writeNoteEntity(noteEntity);
if (!writeSuccessful) {
Logger.getLogger(FilebasedNoteService.class.getName()).log(Level.SEVERE, "Can't write note entity to d... |
fab09766-f3c5-46e9-806d-875e68d8fbde | 1 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
getStageManager().setStatge(StageManager.STAGE_MENUE, null);
}
} |
7be7bc1f-4517-4ab9-9b85-7b3f93c648d2 | 7 | @Override
public void spring(MOB mob)
{
final Room room=mob.location();
if(room != null)
{
final Set<MOB> friendlySet=new HashSet<MOB>();
if(invoker()!=null)
invoker().getGroupMembers(friendlySet);
room.show(mob, affected, CMMsg.MSG_OK_ACTION, L("<T-NAME> explodes, spraying clumps of stomach acid e... |
1cf36318-1c45-438a-bf80-dc2f0f192084 | 8 | public void Profile(){
int opt;
System.out.println("Email: "+email+", Nombre: "+name+", Fecha de ingreso: "+fecha);
do{
System.out.println("\t1.Cambiar mi email");
System.out.println("\t2.Cambiar mi password");
System.out.println("\t3.Cambiar mi nombre");
... |
adc7fd49-22ad-481a-9532-c74a251e11a5 | 7 | public final void list_if() throws RecognitionException {
try {
// Python.g:426:9: ( 'if' test ( list_iter )? )
// Python.g:426:11: 'if' test ( list_iter )?
{
match(input,85,FOLLOW_85_in_list_if3804); if (state.failed) return;
pushFollow(FOLLOW_test_in_list_if3806);
test();
state._fsp--;
if (s... |
6739c943-328e-4eba-9197-c20eb4ae7c95 | 2 | public static void main (String[] args){
int topics = 4;
int depth = 2;
int iter = 100;
//Creating the main edge data structure
HashMap<SparseMatrix, Integer> edge_freq = new HashMap<SparseMatrix, Integer>();
long startTime = new Date().getTime();
//edge_freq = LoadAndRead.ReadEdge( Folder + "... |
9414bbc1-1627-4908-a05b-e80acfeccd53 | 0 | public void RestartGame() {
playerCar.ResetPlayer();
//clear list
courseList.clear();
} |
0bec2400-7c77-4e70-a319-a9e7ebcff87e | 4 | @Override
public ResultSet query(String query) {
Statement statement = null;
ResultSet result = null;
try {
connection = this.open();
statement = connection.createStatement();
switch (this.getStatement(query)) {
case SELECT:
result = statement.executeQuery(query);
return result;
default... |
84c890b5-0777-4b66-8e2b-7b497b925ae2 | 3 | private void uniq() {
if (values.length == 0) {
return;
}
final int[] v = new int[values.length];
final Label[] t = new Label[values.length];
v[0] = values[0];
t[0] = targets[0];
int j = 1;
for (int i = 1; i < values.length; i++) {
if (v[j - 1] != values[i]) {
v[j] = values[i];
t[j] = ... |
36ec31a8-468d-4ccf-a0b5-4a6a34dc865a | 5 | public void updateLoop()
{
// Start the timer.
timer.start();
// Loop as long as the window is visible.
while (isVisible() && !exit)
{
// Update the timer.
timer.update();
// Calculate the startup time.
DebugManager.getInstance().setPhaseStartTime();
// Handle the mouse and keyboard input.
... |
7c9c3996-5de5-43ec-9063-51103a20ea3f | 5 | @Override
protected boolean canRun(ClassNode node) {
if (!node.superName.equals(classNodes.get("Renderable").name) || classNodes.containsKey("Item"))
return false;
ListIterator<MethodNode> mnli = node.methods.listIterator();
while (mnli.hasNext()) {
MethodNode mn = mn... |
3cb495dd-d8c5-45cf-b088-33640c7302df | 2 | private void generateHardwareSystemsGeneration(int alternatives, int[] possibilities, int[] repetitions) {
for (int i = 0; i < alternatives; i++) {
HardwareSystem hardwareSystem = new HardwareSystem();
for (int j = 0; j < project.getHardwareSets().size(); j++) {
int index = (i / repetitions[j]) % project.ge... |
355e8072-4131-472c-8dd7-5ce4636add51 | 1 | protected void distributeChangeEvent(String old) {
ExpressionChangeEvent e = new ExpressionChangeEvent(this, old);
Iterator it = listeners.iterator();
while (it.hasNext()) {
ExpressionChangeListener l = (ExpressionChangeListener) it.next();
l.expressionChanged(e);
}
} |
c5db04d8-bb39-4cae-b586-b5c4b76dbd87 | 4 | @Override
protected void process_pipe_term ()
{
// This is the simple case of peer-induced termination. If there are no
// more pending messages to read, or if the pipe was configured to drop
// pending messages, we can move directly to the terminating state.
// Otherwise we'... |
571b6581-6c5b-43f7-920d-5939153e3b88 | 7 | static private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
... |
2f106354-b989-4af6-ac30-aed54cce0ee0 | 5 | private static SortedMap<String, Method> getAllThreads(
MultithreadedTestCase test) {
SortedMap<String, Method> result = new TreeMap<String, Method>();
for (Class<?> eachClass : getSuperClasses(test.getClass())) {
Method[] methods = eachClass.getDeclaredMethods();
for (Method method : methods) {
fina... |
7afc417b-3744-42a5-ba3b-47980a870a25 | 8 | public void findTopSpawners(CommandSender sender) {
Map<Block, MSCSpawner> activeSpawners = plugin.myListener.activeSpawners;
topSpawners.clear();
// Iterating through all spawners in the hashmap
Iterator<MSCSpawner> it = activeSpawners.values().iterator();
// Temporary list to store the top ten spawners in... |
07390d63-cd5a-403f-899d-55a30d7ea13e | 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... |
20da1bfe-737f-48f5-a19d-8171ba5452bc | 1 | public Builder mass(double receivedMass) {
if (receivedMass < 0) {
throw new IllegalArgumentException("Mass must be > 0. Received value =" + receivedMass);
}
this.mass = receivedMass;
return this;
} |
eb42f432-7b6c-40dc-96ff-36dc9da6f67f | 4 | @Override
protected void sort(int[] a) {
while (true) {
boolean swapped = false;
for (int i = 1; i < a.length; i++) {
if (a[i - 1] > a[i]) {
swap(i - 1, i);
swapped = true;
}
}
if (!swap... |
a7a6b54e-57ee-44a6-992b-931f286ae6ec | 6 | public RegisteredEventListener(Method listenerMethod, Listener listener){
//Attempt to get the EventListener annotation on this method
EventListener listenerAnnotation = listenerMethod.getAnnotation(EventListener.class);
if(listenerAnnotation == null){
//No annotation, throw exception
throw new IllegalArgum... |
ec5a283e-ee56-4481-88e2-35c0a8fc0393 | 9 | @Override
public String toString() {
if (code >= 90 && code <= 115) {
return "" + ((char) (code - 25));
}
if (code >= 64 && code <= 89) {
return "" + ((char) (code + 33));
}
if (code >= 117 && code <= 126) {
return "" + ((char) (code - 69))... |
66aadaf5-381e-49cc-9aff-ded58264fa52 | 4 | @Override
public void deserialize(Buffer buf) {
uid = buf.readInt();
if (uid < 0)
throw new RuntimeException("Forbidden value on uid = " + uid + ", it doesn't respect the following condition : uid < 0");
targetId = buf.readInt();
turnDuration = buf.readShort();
di... |
555b4f12-55d3-41ff-b612-20e321aa18e2 | 8 | public static boolean isSimple(mxAnalysisGraph aGraph)
{
Object parent = aGraph.getGraph().getDefaultParent();
Object[] edges = aGraph.getChildEdges(parent);
// self loop detection
for (int i = 0; i < edges.length; i++)
{
Object currEdge = edges[i];
if (aGraph.getTerminal(currEdge, true) == aGraph.ge... |
d2504229-a8e8-4ed0-b611-cef3435e87fb | 5 | public void trackColor(int x, int y, int rgb)
{
if (isDominant(this.color, rgb))
{
xmin = (xmin>x) ? x : xmin;
xmax = (xmax<x) ? x : xmax;
ymin = (ymin>y) ? y : ymin;
ymax = (ymax<y) ? y : ymax;
foundColor = true;
}
... |
687f9a90-1c80-427a-9858-31ca37122b22 | 7 | public Integer insert(TipoProductoBeans producto) throws DAOException {
PreparedStatement pst = null;
ResultSet generatedKeys = null;
try {
pst = con.prepareStatement(sql.getString("INSERT_TIPO_PRODUCTOS"),
Statement.RETURN_GENERATED_KEYS);
pst.setString(1, producto.getNombre());
pst.setStri... |
8e8305b4-1412-43d9-90e9-2d09904f66cd | 3 | @Override
public Map<Integer, Integer> getShoppingCart(UserModel user)
throws WebshopAppException {
if (isValidUser(user, "GET_SHOPPING_SHOPPING_CART_CONTENTS")) {
try (Connection conn = getConnection()) {
String sql = "SELECT product_id, quantity FROM shopping_cart WHERE user_email = ?";
try (Prepa... |
7aebbdf4-d21b-4556-bded-30876954aef5 | 2 | public static void printClass(Class<?> cl)
{
System.out.print(cl);
printTypes(cl.getTypeParameters(), "<", ", ", ">", true);
Type sc = cl.getGenericSuperclass();
if (sc != null)
{
System.out.print(" extends ");
printType(sc, false);
}
printTypes(cl.getGener... |
5623c19a-35c6-4faa-9859-25e0675c605e | 3 | public void handleSpecial(String line) {
if (line != null) {//SPECIALUSER name type
String[] split = line.split(" ");
String user = split[1].toLowerCase();
if (split[2].equalsIgnoreCase("admin")) {
updateUser(null, ADMIN, user);
}
if (s... |
29b1d991-d0a9-4d0f-aeb9-117124c76915 | 3 | public void cargarArchivo(String path){
try
{
Configuracion c = principal.configuraciones.buscar(principal.getCurrentServer());
if(c==null){
c = principal.configuraciones.getConfigLocal();
}
FileInputStream fileIn = new FileInputStream(c.getStra... |
f2be7c03-4c58-48e0-be0b-214ce4b05a62 | 5 | private void updateRequiredConstraints(final DVConstraints dvConstraints,
final Map<Variable, Expression> varAssignments)
throws VerifyException {
for (Variable[] constraint: dvConstraints) {
assert (constraint.length == 2): "Invalid constraint length";
final Expression exp1 = varAssignments.get(constraint[... |
d749e555-8aa9-4871-ae88-996973a82ce1 | 6 | public String getDescription() {
if(fullDescription == null) {
if(description == null || isExtensionListInDescription()) {
fullDescription = description==null ? "(" : description + " (";
// build the description from the extension list
Enumeration extensions = filters.keys();
if(extensions != null) {
... |
c6e87b56-259e-45b8-b9df-d6b97e7c84d2 | 5 | private Elem[] parseList(String pattern) {
List<Elem> list = new LinkedList<Elem>();
StringBuilder s = new StringBuilder(pattern);
int brackets = 0;
s.append(',');
for (int i = 0; s.length() > 0; i++) {
char c = s.charAt(i);
... |
e7787f6c-8ca0-43ff-b268-0ed8f5503a7e | 4 | private void cambiarNombre(){
final Juego juego = ((Juego) listJuegos.getSelectedValue());
if( juego == null )return;
final String nombre = JOptionPane.showInputDialog( this,
"El nombre del juego debe estar\ncomprendido entre 3 y 15 caracteres "
... |
a206bbd9-90a7-4842-a204-431f0bf73c9a | 0 | public int hashCode() {
return _lowerNick.hashCode();
} |
40e39809-2328-4d9f-a9ea-4be0daf94d73 | 0 | public void setCsaPosId(int csaPosId) {
this.csaPosId = csaPosId;
} |
83aa3de6-6d45-48af-9f5d-2e6f40609827 | 3 | private int trLog (int n) {
return ((n & 0xffff0000) != 0) ?
(((n & 0xff000000) != 0) ? 24 + log2table[(n >> 24) & 0xff] : 16 + log2table[(n >> 16) & 0xff])
: (((n & 0x0000ff00) != 0) ? 8 + log2table[(n >> 8) & 0xff] : 0 + log2table[(n >> 0) & 0xff]);
} |
a7ae55a7-7e32-4151-826a-d1379d7efab9 | 8 | private Dimension layoutSize(Container target, boolean preferred)
{
synchronized (target.getTreeLock())
{
// Each row must fit with the width allocated to the containter.
// When the container width = 0, the preferred width of the container
// has not yet been calculated so lets ask for the maximum.
int ... |
1448ead2-6d21-432e-ad5d-79f2b330c7a8 | 1 | @Override
public final void inc(final Integer... a) {
for (final Integer i: a) { filter[i]++; }
} |
e188330b-7c3f-4b9c-b422-f1a8d3c939ac | 0 | @AfterClass
public static void tearDownClass() {
} |
7c1b2e90-fce6-4cd2-b42a-f040ea5b5d9a | 0 | public Point2D getBottomLeft() {
return new Point2D(x, height);
} |
5ea5439d-9a11-4d54-b1dc-6e459d7e23b7 | 4 | @Override
public void close() {
if (reader != null)
reader.interrupt();
if (reader != null)
writer.interrupt();
try {
if (socket != null) {
socket.close();
}
} catch (IOException e) {
/*
* Ignore exception.
*/
}
socket = null;
super.close();
} |
b097f90c-e6c2-484d-b623-8ca32a7e5920 | 4 | public static void m() {
for (int j=0; j<20; j++) {
final int k = j;
new Thread(new Runnable() {
@Override
public void run() {
if (k == 1) {
PrintStream ps = System.err;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
int i = 0;
i = 1 / i;
... |
76206d66-df9b-45e8-8468-b20c111e9755 | 1 | public double getRange() {
double extraRange = 0;
for (GameAction action: getBuffers()) {
extraRange += action.getExtraRange();
}
return range+ extraRange;
} |
3d8c0ccc-e3a2-4cf5-8a08-adedfd434175 | 2 | public void update() {
x += speedX;
r.setBounds(x,y,10,5);
if (x > 800) {
visible = false;
r = null;
}
if (x < 801){
checkCollision();
}
} |
85d5b438-16a1-4a80-8de4-2d824a6aef5d | 6 | public static String escape(String string) {
StringBuffer sb = new StringBuffer();
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
cas... |
9aa4c45f-f757-43fe-af75-c44aee6581a0 | 7 | private static String formattedDoubleToString(double x, int places) {
String result = "";
String stack = "";
long t;
// put in a minus sign as needed
if (x < 0.0)
result += "-";
// put in a leading 0
if (-1.0 < x && x < 1.0)
result += "0";
else {
t = (long)x;
if (t < 0)
t = -t;
... |
6ae45bd4-bb69-47aa-a065-fc62813c6dda | 3 | @Override
public void paintObj(Graphics g, JComponent c) {
Graphics2D g2d = (Graphics2D) g;
for (int i = 0; i < Board.robots.size(); i++) {
g2d.setColor(Color.WHITE);
if(Board.robots.get(0) == this.owner){
g2d.setColor(Color.red);
} else i... |
23302be1-78d1-45bc-8ef9-c98e8bbac553 | 7 | public void saveScoreStats()
{
File file = new File("Scores.txt");
boolean flag = false;
FileWriter writer;
ArrayList<String> scoreData = new ArrayList<String>();
ListIterator<String> iterator;
try
{
Scanner s = new Scanner(file);
while(s.hasNextLine())
{
scoreData.add(s.nextLine());
... |
e74b03a9-6d71-44fd-bacd-5c56516f8c01 | 3 | private void calculateGyro(long timeStamp) {
// don't start until first accelerometer/magnetometer orientation has been acquired
if (!hasOrientation) {
return;
}
// Initialization of the gyroscope based rotation matrix
if (!initState) {
gyroMatrix = matrixMultiplication(gyroMatrix, rotationMatrix);
... |
d4d42ccc-c033-480f-aefe-704c92fb3d42 | 9 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
final Classifier<String, String> bayes =
new BayesClassifier<String, String>();
System.out.print("Please enter a training file: ");
String trainingFile = input.nextLine();
System.out.... |
87116211-c5ed-4cbf-a130-4a2f94b29363 | 0 | public static BeerResponseList create(Iterable<Beer> beers) {
return new BeerResponseList(beers);
} |
17fb49e3-24f8-432f-b820-14fad398a28f | 8 | static Method getMethod(Class cls,String name,Object [] args) {
Class [] args_cls = new Class[args.length];
for (int i=0; i<args.length; i++) {
if (args[i] instanceof Boolean) {
args_cls[i] = Boolean.TYPE;
} else if (args[i] instanceof Character) {
args_cls[i] = Character.TYPE;
} else if (args[i] i... |
87accaf1-9b3d-4d93-a37f-d2bc1fcc5a2a | 0 | public static boolean isApplicable(Object object) {
return object instanceof RegularExpression;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.