method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0182a442-98db-4e76-81e9-ef353e5ea981 | 9 | private void list () {
String options;
String name;
boolean onlyArmed;
Item[] data;
while (true) {
name = "";
onlyArmed = false;
System.out.println("O que você deseja visualizar?\n" +
"a. Informações sobre um item\n" +
... |
05ce4526-6fff-4a78-9686-a6f54fd3edb4 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((marca == null) ? 0 : marca.hashCode());
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result + ((preco == null) ? 0 : preco.hashCode());
r... |
f6f1a330-e161-49fc-b6d8-2893a2a9dda3 | 2 | public static ConnectionType byPersistentName( String name ){
for( ConnectionType type : values() ){
if( type.getPersistentName().equals( name )){
return type;
}
}
throw new IllegalArgumentException( "unknown name: " + name );
} |
2e2bb7d7-acac-4802-b592-2229e72ea13e | 5 | public void analyseForKeywords(String filename)
{
LinkedList<String> foundKeywords = extractKeywords(filename);
Vector<String> keywordsToAdd = new Vector<String>();
for (String word : foundKeywords)
{
word = word.toLowerCase();
//for... |
d9f5a07c-e810-4d06-8f4d-c28a3f39ed66 | 4 | @Override
public void load() {
Plugin cp = Bukkit.getServer().getPluginManager().getPlugin("CoreProtect");
// Check that CoreProtect is loaded
if (cp != null && cp instanceof CoreProtect) {
this.coreprotect = ((CoreProtect)cp).getAPI();
if (coreprotect.isEnabled()==true){
if (coreprotect.APIVersion() ... |
45b64ce5-2c1d-4c58-a155-bb8fb52de6a1 | 0 | @Override
public void windowDeiconified(WindowEvent arg0)
{
} |
a50ffa18-93c4-4898-b8c0-2271f752cc07 | 4 | public static boolean isAlphanumericSpace(String str)
{
if (str == null)
{
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++)
{
if ((Character.isLetterOrDigit(str.charAt(i)) == false) && (str.charAt(i) != ' '))
{
... |
11a9bb07-3d98-4ae0-996f-a847f467bef7 | 2 | public V get(K key) {
for (int i = 0; i < currentSize; ++i) {
if (key == keys[i]) {
currentIndex = i;
return values[i];
}
}
return null;
} |
1d50eca2-3d27-487e-bcac-b6387a2f9b89 | 3 | @Override
public void copyFrom(Matrix source) {
if (!isSameLength(source))
throw new IndexOutOfBoundsException("mxn do not equal this matrix");
for (int i = 1; i <= this.getM(); i++) {
for (int j = 1; j <= this.getN(); j++) {
this.insert(i, j, source.get(i, j));
}
}
} |
95041405-47ab-4730-a38c-fed42211d1c4 | 8 | public NBestIterator(TagLattice<String> lattice,
int[] tokenStarts,
int[] tokenEnds,
int maxResults,
String beginTagPrefix,
String inTagPrefix,
St... |
91e7248a-7d7b-41cd-873d-ce2b1506fd2e | 0 | public Employee clone() throws CloneNotSupportedException
{
// call Object.clone()
Employee cloned = (Employee) super.clone();
// clone mutable fields
cloned.hireDay = (Date) hireDay.clone();
return cloned;
} |
40ca07fb-a511-4423-b3cc-9d344a175054 | 4 | private void addAll()
{
// Traverse hierarchy
Class<?> clazz = this.object.getClass();
do
{
// Traverse methods
for(Method m : clazz.getDeclaredMethods())
// Add
this.add(m);
}while((clazz = clazz.getSuperclass()) != IJeTTEventCallback.class &&
clazz != Object.class);
} |
1378590b-26c5-4da5-a278-9218d6a4c49b | 8 | private RepairCandidate errorRecovery(int error_token, boolean forcedError) {
this.errorToken = error_token;
this.errorTokenStart = lexStream.start(error_token);
int prevtok = lexStream.previous(error_token);
int prevtokKind = lexStream.kind(prevtok);
if(forcedError) {
int name_index = Parser.terminal_in... |
1e9b53e2-8bb7-497d-8c36-99c86e5af9fe | 2 | private boolean pluginFile(String name) {
for (final File file : new File("plugins").listFiles()) {
if (file.getName().equals(name)) {
return true;
}
}
return false;
} |
36cab972-626d-44aa-8cc2-d19cfaed2e9b | 2 | public void save() {
String name = JOptionPane.showInputDialog(this, "Enter a name for the table.");
mortgage.setName(name);
mortgage.setStartCapital(startCapital);
try {
mortgages.addBusinessObject(mortgage);
dispose();
} catch (DuplicateNameException e) {
A... |
2f9f1540-6b88-49fb-8a48-0363b48bf948 | 4 | public void unMuteMedia() {
if (Debug.video) System.out.println("VideoPlayer -> unMuteMedia called");
if ((null != player) && realizeComplete) {
gainControl.setMute(false);
if (Debug.video) System.out.println("VideoPlayer -> unMuteMedia un-set");
}
} |
e6a4bb4b-10be-451d-a644-5b3ba2f13c6a | 9 | protected org.w3c.dom.Node getAdapter()
{
if (adapter == null)
{
switch (this.type)
{
case RootNode:
adapter = new DOMDocumentImpl(this);
break;
case StartTag:
case StartEndTag:
... |
9e6c9046-a8c1-4d3d-87f7-b3e2185f8b14 | 9 | private void readSubframe(int channel, int bps) throws IOException, FrameDecodeException {
int x;
x = bitStream.readRawUInt(8); /* MAGIC NUMBER */
boolean haveWastedBits = ((x & 1) != 0);
x &= 0xfe;
int wastedBits = 0;
if (haveWastedBits) {
... |
fb78867a-ca9e-432b-9e12-221549e43f96 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainActivity window = new MainActivity();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
a28fca55-5c34-4db5-b314-36573d8d3c56 | 6 | private void loadDay() throws SQLException, Exception {
dDL = new DayDL(c);
DecimalFormat decFormat = new DecimalFormat("#.##");
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date date = new java.util.Date();
java.sql.Date sqlDate = StrUtil.datePar... |
295ea297-dd4a-4abb-b0ca-0bd245145f2e | 3 | private final void createStateManager() {
// I wonder if we can lazily load this each time somehow?
stateManager = new StateManager("mainMenuStateManager");
// Add the state which will animate the buttons coming into the screen
// from either set. When the buttons have reached the middle it will
// transitio... |
fe710324-93db-4c58-8b2b-d9fbd657b6c4 | 3 | public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) {
final Expr[] dims = expr.dimensions;
for (int i = 0; i < dims.length; i++) {
if (dims[i] == previous) {
if (i > 0) {
check(dims[i - 1]);
} else {
previous = expr;
expr.parent().visit(this);
}
}
}
} |
1968ce61-fab9-432b-80ba-f942f6d75f27 | 0 | public int getACC() {
return acc;
} |
a0e7841b-5825-47ea-8ebc-537b3eed4ab7 | 9 | public int squeezOutOf(AABB r, Vec2D a_out)
{
// up, left, down, right
double[] squeeze = {max.y-r.min.y, max.x-r.min.x, r.max.y-min.y, r.max.x-min.x};
int collidingSide = 0;
for(int i = 0; i < squeeze.length; ++i)
{
if(squeeze[i] < squeeze[collidingSide])
collidingSide = i;
}
double dx = 0, dy = ... |
dc996e6d-7c11-462a-a43f-51b7eb085fc3 | 7 | protected AbilityWorldConfig(FileConfiguration cfg, String folder)
{
/* ################ UseWorldSettings ################ */
if (folder.length() != 0)
{
useWorldSettings = cfg.getBoolean("UseWorldSettings", false);
set(cfg, "UseWorldSettings", useWorldSettings);
}
/* ################ EnabledSpawn... |
7b23153a-6232-4540-9291-4c4ecd49ca1b | 8 | public String GetPreviousLine(int pindex) {
int tindex = pindex;
while ((tindex > 0 )&& (iExpr.toCharArray()[tindex] != '\n')) {
tindex--;
}
if (iExpr.toCharArray()[tindex] == '\n') {
tindex--;
} else {
return "";
}
while ((t... |
1e018233-904f-4168-8909-6c8381473630 | 9 | private final void method678(boolean bool, byte i) {
if (6 * anInt5537 > (((ByteBuffer) (((OpenGlToolkit) aHa_Sub2_5598)
.aClass348_Sub49_Sub1_7798))
.payload).length)
((OpenGlToolkit) aHa_Sub2_5598).aClass348_Sub49_Sub1_7798
= new FloatBuffer(6 * (anInt5537 - -100));
else
((ByteBuffer)
... |
802263a0-377b-4ab7-a25e-6ea2365ab3d0 | 1 | protected void processLoop() {
currentTime = 0f;
if(reverse) {
endingValue.negate(endingValue);
}
} |
a8ddf0d4-be32-4520-8736-e1f405a44b10 | 9 | private void binData(boolean lPerformed) {
double max;
int bin;
boolean performLaplace = false;
min = max = data.get(0);
for(double d : data)
if(d>max)max=d;
else if(d<min)min=d;
interval = (max - min)/((double)numBins - 1.);
... |
5dc48015-9f7d-448e-980a-46366d20d1ee | 8 | public void putAll( Map<? extends Long, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Long,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Byte> e = it.next();
this.put( e.getKey(), e.... |
e5edda50-181d-440d-b34b-176476a42832 | 0 | private void initPopupMenu(){
mainPopupMenu = new JPopupMenu();
ImageIcon itemCopyIcon = new ImageIcon(Main.ICO_PATH + "page_copy.png");
JMenuItem itemCopy = new JMenuItem(" Copy ", itemCopyIcon);
itemCopy.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(Mous... |
e69ca936-d191-4991-ad38-493fa2b712fa | 1 | public void cmpg(final Type type) {
mv.visitInsn(type == Type.FLOAT_TYPE ? Opcodes.FCMPG : Opcodes.DCMPG);
} |
d3e2f2cb-f1ca-4728-b3e6-de495225fc46 | 9 | public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Usage: java -jar sezpoz.jar [ something.jar | some.serialized.Annotation ]+");
}
for (String arg : args) {
System.out.println("--- " + arg);
byte[] magic = ne... |
1602f7e5-07fa-4a58-adda-772436bad856 | 4 | public static synchronized void loadFromPreferences() {
if (!LOADED) {
Preferences prefs = Preferences.getInstance();
for (Command cmd : StdMenuBar.getCommands()) {
String value = prefs.getStringValue(MODULE, cmd.getCommand());
if (value != null) {
if (NONE.equals(value)) {
cmd.setAccelerator... |
9909e33b-21fa-48c2-bb1d-eb723177a6cd | 4 | PERange intersection(PERange rangeb) {
if(rangeb == null) {
return null;
}
int s = (this.begin < rangeb.begin) ? rangeb.begin : this.begin;
int e = (this.end < rangeb.getEnd()) ? this.end : rangeb.getEnd();
return (s > e) ? null : new PERange(s, e);
} |
d01e7c1e-4929-4f5d-8249-8d3105be86a2 | 4 | public static String downloadURL(URL url) {
InputStream in = null;
try {
in = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder sb = new StringBuilder();
char[] buffer = new char[1024];
int ... |
0f0dbea2-6765-4d12-bba5-9e67ccf06d4c | 9 | public String toString() {
String ns = "";
Talent currentTalent = null;
ns += name + ": " + (current?"Current":"Not Current") + "\n";
ns += "\n Offense:\n";
for (int i=0;i<offense.length;i++) {
for (int j=0;j<offense[0].length;j++) {
for (Talent e : ta... |
c0c93bef-5966-49c1-a3b4-b3adabbc4843 | 4 | public final void endElement(
final String ns,
final String lName,
final String qName) throws SAXException
{
// the actual element name is either in lName or qName, depending
// on whether the parser is namespace aware
String name = lName == null || lName.length() == ... |
40dfb34e-ec32-46db-bf68-5dc0367b399d | 6 | public String appendToText(String name, String journalID, String text) {
Journal temp = null;
for (Journal j : db) {
if (journalID.equals(j.getID()))
temp = j;
}
if (nurses.contains(name)) {
if (name.equals(temp.getNurse())) {
temp.changeText(text);
log.addEntry(name, temp.getID(), "User added... |
b04d8660-b77d-4239-b045-7e7f307cfbd6 | 6 | private boolean inputRFCHandling(String stdInString) {
// split standard Input into tokens, token cut by " "
String tokenToFind = " ";
StringTokenizer token = new StringTokenizer(stdInString, tokenToFind);
int arraySize = token.countTokens();
String foundToken[] = new String[arraySize];
// find all tokens ... |
4b55dfc4-54ff-4c05-97aa-46c07399033a | 8 | public void update(double dt) {
xPos+=xVel*dt;
yPos+=yVel*dt;
xVel+=xAccel*dt;
yVel+=yAccel*dt;
setAccel(dt);
Ball b=null;
for(int i=0;i<MainClass.balls.size();i++) {
b=MainClass.balls.get(i);
if(b!=null && id<b.id && collides(b)) {
bounce(b,i);
}
}
if(xPos-radius<MainClass.wa... |
9a67a601-fedb-4896-a9dd-17f4285783b3 | 1 | public String toString() {
return "FROM:" + indexFrom + (indexTo == -1 ? "" : " TO " + indexTo) + " TYPE FROM: " + moveTypeFrom + " TYPE TO: " + moveTypeTo;
} |
14496714-64bd-47b3-ab68-5efb99193bef | 1 | private void handleOpenMenuItemClick() {
JFileChooser fileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Xml files", "xml");
fileChooser.setFileFilter(filter);
if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
this.controller.onLoadMenuItem... |
94b48c7f-05ab-4289-85e2-b97270610a14 | 2 | private void drawEmptyGrid(Graphics g) {
g.setColor(Color.BLACK);
for (int i = 0; i <= nbRows; i++) {
for (int j = 0; j <= nbColumns; j++) {
g.drawLine(caseHeight * i, 0, caseHeight * i, nbColumns
* caseHeight + 1);
g.drawLine(0, caseWidth * j, nbRows * caseWidth + 1,
caseWidth * j);
}
}... |
9b9f6d5e-b59a-4d14-9e3a-f8c00f69e0c8 | 2 | public static boolean check_repeat_symbol(Symbol_table symbol_table, String name) {
for (int i = 0; i < symbol_table.symbol_name.size(); i++) {
if (symbol_table.symbol_name.get(i).toString().equals(name)) {
return false;
}
}
return true;
} |
6e83cfc2-60de-4e3f-96ed-448b23d4608c | 4 | private void nextPiece() {
if(current == null){
this.current = Tetromino.generatePiece();
this.next = Tetromino.generatePiece();
} else {
this.current = this.next;
this.next = Tetromino.generatePiece();
}
side.updateNext(next);
orientation = 0;
currentCol = current.getTiles()[0].length == 16 ? ... |
d2adba32-d0ab-48cf-ae91-a2b159ff6c18 | 4 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nEdges = Integer.parseInt(in.readLine().trim());
start = 1;
target = 2;
HashMap<String, Integer> mapNames = n... |
d692eda3-7416-4ad2-b322-b06923c1edb2 | 4 | private boolean Rule_0()
{
begin("");
if (!Name()) return rejectInner();
if (!EQUAL()) return rejectInner();
if (!RuleRhs()) return rejectInner();
DiagName();
if (!SEMI()) return rejectInner();
return acceptInner();
} |
2972f7a0-988e-4222-8665-2001f7d9bd63 | 3 | public static int[] sort(int[] list) {
if (list.length == 1) {
return list;
} else {
int[] listL = new int[list.length / 2];
int[] listR = new int[list.length - list.length / 2];
int Center = list.length / 2;
for (int i = 0; i < Center; i++) {
... |
9401f9b9-8f5f-4522-842b-01b36ef3268e | 3 | public void writeOrFail(String fileName) throws IOException
{
String extension = this.extension; // the default is current
// create the file object
File file = new File(fileName);
File fileLoc = file.getParentFile(); // directory name
// if there is no parent directory use the current media dir... |
fe572dd8-8cf7-4450-8671-c735d6594b88 | 4 | public List<String> getStringList(String path, List<String> def) {
if(def == null)
def = new ArrayList<String>();
List<?> list = super.getList(path, def);
if(list == null)
return def;
try {
@SuppressWarnings("unchecked")
List<String> sList = (List<String>) list;
return sList;
} catch (Exception... |
c6b51c78-39ba-4864-8bf5-0317bd6c4fca | 4 | @Override
public List<Object> getAll(String type){
try {
db.start();
DBCollection collection = db.getDB().getCollection("nonmoves");
XStream xStream = new XStream();
DBCursor cursor = collection.find();
if (cursor == null)
return null;
List<Object> commands = new ArrayList<Object>... |
9140868e-f9bd-48ea-b7a6-0ed7c8c6d453 | 2 | protected void cut(Fibonaccinode x, Fibonaccinode y) {
x.left.right = x.right;
x.right.left = x.left;
y.degree--;
if (y.child == x) {
y.child = x.right;
}
if (y.degree == 0) {
y.child = null;
}
x.left = min;
x.right = min.ri... |
23716404-4678-4966-a7f8-ee8250cd84e9 | 4 | @Override
public void onAudioSamples(IAudioSamplesEvent event) {
if (currentSection != null) {
Long timeStamp = event.getTimeStamp(currentSection.getTimeUnit());
if (currentSection.getStart() < timeStamp) {
adjustVolume(event);
if (currentSection.getEnd() < timeStamp) {
... |
322e1b3a-c87b-4eda-b7bd-f054abc42105 | 4 | public RPCMessageImpl(AuthNodeId authNodeId, Authenticator authenticator, RPC rpc)
{
if (authNodeId == null)
throw new NullPointerException("The authNodeId is null!");
if (authenticator == null)
throw new NullPointerException("The authenticator is null!");
if (rpc == null)
throw new NullPointerException... |
ea629c4b-940b-4d2a-9fd3-5df066c5a6e0 | 7 | public InputSplit[] getSplits(JobConf jobConf, int numSplits) throws IOException {
// Get the splitsize (number of rows), defaults to 100,000 as much larger seems to
// screw up getting accurate rows
int splitSize = Integer.parseInt(jobConf.get(SimpleDBInputFormat.SIMPLEDB_SPLIT_SIZE, ... |
294df646-a5f7-4417-9d7c-07e5db839730 | 8 | @Override
public void run() {
if (stopped || this.tokens.length == 0)
return;
System.out.println("executing search");
try {
this.cmd = getCmd(getLongest(tokens));
String line;
String file;
int n = 0;
String[] dbentry;
p = Runtime.getRuntime().exec(cmd);
BufferedReader input = new Buffere... |
da9108f1-3681-455b-96e6-7977204a1534 | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((adjacentNodes == null) ? 0 : adjacentNodes.hashCode());
result = prime * result + ((edgeState == null) ? 0 : edgeState.hashCode());
... |
954b3cdb-cbbe-4cdc-bb0b-90aa22d27a1d | 8 | public void onTurn(Board board) {
if (board.getMovablePos().isEmpty()) {
System.out.println("pass your turn");
board.pass();
return;
}
while(true) {
System.out.print("input point ex.\"f5\" or (u:undo/x:exit):");
BufferedReader stdin =
new BufferedReader(new InputStr... |
b00e95cd-f2d3-4e50-b4c1-e82dfe8409aa | 3 | public void initKeyListeners() {
KeyListener deleteListener;
deckTable.addKeyListener(deleteListener = new KeyListener() {
public void keyPressed(KeyEvent k) {
if (k.getComponent() instanceof JList) {
switch (k.getKeyCode()) {
case KeyEvent.VK_DELETE: removeCardsInImageListBuffer();
break;
... |
493110bf-6ea3-42a6-bf02-2c7c419547a6 | 4 | public APacket getNewPacketOfID(int id) {
try {
return PList.get(id).getConstructor().newInstance();
} catch(InstantiationException e) {
e.printStackTrace();
//Log.getInstance().logError("PacketRegistrie", "Could not Instantiate " + PList.get(id) + " probably missing public default Constructor");
throw ... |
374e8be8-f2d0-43ee-aab5-3c7bb65aac74 | 2 | @Override
public int compareTo(CubeNode b) {
if (this.heuristic < b.heuristic) {
return -1;
} else if (this.heuristic > b.heuristic) {
return 1;
}
return 0;
} |
0a95a3e5-b21f-4f30-9cbe-7651ab1f95bd | 3 | public void logShip (String mmsi) {
UserIdentifier uid=new UserIdentifier();
// First check if a ship has already been logged and is in the list
int a;
for (a=0;a<listLoggedShips.size();a++) {
if (listLoggedShips.get(a).getMmsi().equals(mmsi)) {
// Increment the log count and return
listLoggedShips.g... |
e8a4d9a9-354c-45c3-a9c0-f40c832d164a | 2 | public void zeichneKartenAusschnitt(Graphics g){
//fenster.ofView
int ausschnitt_x = fenster.ofView.x;
int ausschnitt_y = fenster.ofView.y;
int ausschnitt_ende_x = ausschnitt_x+20,ausschnitt_ende_y = ausschnitt_y+20;
for(int x = ausschnitt_x, rx =0;x < ausschnitt_ende_x;x++,rx++){ /*level.karte.getWidt... |
46058941-87fb-4969-a1f4-347838b3b191 | 5 | public ArrayList<FullLocation> list(String locationName) throws URISyntaxException{
log.trace("Retrieving location list");
JsonObject response = null;
JsonElement locationsAsJson = null;
JsonElement cityAsJson = null;
JsonElement metroAreaAsJson = null;
FullLocation fullLocation = null;
ArrayList<FullLoca... |
5b24c313-fcdb-4022-8599-91b399d2f52b | 3 | public void valueChanged(ListSelectionEvent e) {
resetCardBuffer();
if (!e.getValueIsAdjusting()) {
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
int minIndex = lsm.getMinSelectionIndex();
int maxIndex = lsm.getMaxSelectionIndex();
for (int i = minIndex; i <= maxIndex; i++) {
if (l... |
f8dca0e3-7d1d-4d74-b3dd-41fc18534846 | 7 | public void killOpen(ArrayList<Enemy> e, Rachel r){
if(getXScreen() > 0 && r.getXScreen() > 0){
for(int i = 0; i < e.size(); i++){
Enemy en = e.get(i);
if(en.getXScreen() > 0 && en.getYScreen() > 0){
if(en.isDead()){
killed++;
}//en.isdead
}//en.getxscreen
}//for loop
if(kille... |
c0eb0d26-8ae5-43f5-af09-3db0406588fb | 7 | public void senseLeverDown() throws LeverErrorException {
if((l.getLeverPosition()).equals("OFF")) {
System.out.println("ERROR: leverPosition already at OFF.");
throw new LeverErrorException();
}
else if((l.getLeverPosition()).equals("INT")) {
l.setLeverPosition("OFF");
w.setWiperSpeed(0);
}
else if((l.getLev... |
c2105409-d98a-4de0-baf9-bb75f4031563 | 4 | protected void wireLayers(List<? extends Neuron> inputs, List<? extends Neuron> outputs) {
double weight = 1d / outputs.size();
for (Neuron input : inputs) {
for (Neuron output : outputs) {
output.setInputWeight(input, weight);
}
}
} |
5cd5809c-cbf9-4aa0-ad69-0c6f79fe8891 | 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... |
822f5598-dbef-41c9-b6f0-673d97bb2379 | 8 | private void createAnswerArea(Attributes attrs) {
answerArea = new AnswerArea(answerAreaDef);
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("id"))
answerArea.setId(Integer.valueOf(attrs.getValue(i)));
else if (attrs.... |
f5df8562-cc8d-4231-b538-7d9f195401b0 | 3 | public void printDefinitons() {
for (String key:definitions.keySet()) {
System.out.println(key+":");
for (Vector<PatternComponent> list:definitions.get(key)) {
for (int i = 0; i < list.size(); i++) {
System.out.println("\t"+list.get(i));
}
}
}
} |
67ae9d92-851b-4800-be15-e10b901e18a6 | 9 | public void turnAndMove(double distance, double radians) {
if (distance == 0) {
turnBody(radians);
return;
}
// Save current max. velocity and max. turn rate so they can be restored
final double savedMaxVelocity = commands.getMaxVelocity();
final double savedMaxTurnRate = commands.getMaxTurnRate();
... |
87604e2d-9801-4d3f-8684-8d1ec8224ce8 | 7 | public float parseFloat() throws IOException {
int sign = 1;
int c = nextNonWhitespace();
if( c == '+' ) {
// Unclear if whitespace is allowed here or not
c = read();
} else if( c == '-' ) {
sign = -1;
// Unclear if whitespace is all... |
683fdcae-40d0-48f4-b9b9-0e095e51726b | 6 | public void fusion(){
if(!this.isRacine()){
int index = this.pere.getPointeur().indexOf(this);
Noeud<T> brother;
if(index>0){
brother = this.pere.getPointeur().get(index-1);
if(!this.feuille){
Noeud<T> childOfBrother = brother.getPointeur().get(brother.getPointeur().size()-1);
brother.getVa... |
db3019e4-f495-4da9-ae7a-a8b1f98c031e | 6 | public static boolean compareHydrated(String ion, int ii){
boolean test = false;
if(ion.equals(IonicRadii.hydratedIons1[ii])||ion.equals(IonicRadii.hydratedIons2[ii])||ion.equals(IonicRadii.hydratedIons3[ii])||ion.equals(IonicRadii.hydratedIons4[ii])||ion.equals(IonicRadii.hydratedIons5[ii])||ion.equals... |
8460d7f8-9782-4573-8d4e-1fbc44c80d13 | 4 | String toString(Object o) {
String message = "Could not serialize to json, reason = ";
try {
return gson.toJson(o);
} catch (Exception e) {
message += e.getMessage() + ".";
} catch (StackOverflowError e) {
message += e.getMessage() + ".";
}
... |
c8a70d8e-3265-4d91-b62f-5438725b77d8 | 4 | public InvestManagerDto getInvestManagerDto(String mgrName){
PreparedStatement stmt = null;
ResultSet rs = null;
InvestManagerDto investManagerDto = null;
try {
stmt = conn
.prepareStatement("select mgrName,mgrInfo from InvestManager where mgrName = ? ");
stmt.setString(1, mgrName);
rs = s... |
4664459c-64d0-4d3a-9cf6-63f4a6be62fa | 6 | public static void printKifWrapper(LiteralWrapper self) {
{ OutputStream stream = ((OutputStream)(Logic.$PRINTLOGICALFORMSTREAM$.get()));
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper self000 = ((IntegerWra... |
1b3826e6-3f70-46fd-8886-4d072213f6cb | 1 | public static void main(String[] args) {
Thread t = new Thread(new LiftOff());
// t.start();
System.out.println("Waiting for LiftOff");
for(int i = 0; i < 5; i++)
new Thread(new LiftOff()).start();
} |
1bac45a2-ccf6-4d1d-b950-b1da09b1022a | 3 | public void addItem(int type){
for(int i = 0; i < invCount; i++){
if(inv[i].type == 0){
inv[i].type = type;
if(invCount < inv.length)invCount++;
break;
}
}
} |
93592fc2-299a-4f02-8b77-f6e13d1d882b | 4 | public double rawPersonVariance(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.variancesC... |
ebdcd21c-e890-4823-a9c2-abc27d44c337 | 2 | public static DirectionEnum fromValue(String v) {
for (DirectionEnum c: DirectionEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
675f96d0-c4e8-4372-8864-b8116929b564 | 6 | private void quicksort(Comparable[] items, int low, int high) {
int i = low, j = high;
// Get the pivot element from the middle of the list
Comparable pivot = items[low + (high - low) / 2];
// Divide into two lists
while (i <= j) {
while (items[i].compareTo(pivot) < ... |
4ea2f702-e011-489a-b21b-0d151b91499c | 0 | public TreeSelectionListener[] getTreeSelectionListeners() {
return (TreeSelectionListener[]) treeSelectionListeners.toArray();
} |
64ca7f0a-5653-446c-ba7d-ec022a2dd578 | 4 | public AssociationList getAssociationList(int aiMaxSize, String asLastModified,
String asDeactivated) {
String lsParam = "";
if (aiMaxSize > 0) {
lsParam += "&max_size=" + Integer.toString(aiMaxSize);
}
if (UtilityMethods.isValidS... |
5998f8b9-f803-4ac8-adbb-e2068dbd6a9d | 6 | public void scanVariable() {
final char first = ch;
if (ch != '@' && ch != ':') {
throw new ELException("illegal variable");
}
int hash = first;
np = bp;
sp = 1;
char ch;
if (buf[bp + 1] == '@') {
hash = 31 * hash + '@';
... |
79eb38f4-6a71-4c71-95aa-d5410dfe1c1e | 0 | @Override
public void method2() {
System.out.println("ClassA method2()");
} |
4f8b59a6-a1b7-4c18-88b8-2930f1be1d21 | 8 | @Override
public String toString()
{
switch(this)
{
case DayPref:
return "Day Pref";
case MON:
return "Monday";
case TUES:
return "Tuesday";
case WED:
return "Wednesday";
case THUR:
return "Thursday";
case FRI:
return "Friday";
case SAT:
return "Saturday";
case NOPREF:
retu... |
47eba379-78a6-4966-8451-daff7b4257ca | 6 | public final Clip loadAudioClip(URL clipName) {
Clip loadedClip = null;
try {
// Open an input stream to the specified clip and retrieve clip format information
AudioInputStream inputStream = AudioSystem.getAudioInputStream(clipName);
AudioFormat format = inputStream... |
398e5d04-f27c-4e02-8eb8-6e0c5fb2acc8 | 6 | private void unpackData() {
File tmp = new File(backup);
if(!tmp.exists()) {
error("It seems you don't have a '" + backup + "' yet. Stopping.");
return;
}
try {
BufferedInputStream input = new BufferedInputStream(new FileInputStream(tmp));
... |
4a3bc300-c93d-4ee5-a35e-01d81161921b | 5 | @Override
public boolean checkTable(String table) throws MalformedURLException, InstantiationException, IllegalAccessException {
try {
//Connection connection = getConnection();
this.connection = this.getConnection();
Statement statement = this.connection.createStatement(... |
298b18f6-6960-4975-8d32-720f7deca371 | 4 | public BaseArtifactType newArtifactInstance() {
try {
BaseArtifactType baseArtifactType = getArtifactType().getTypeClass().newInstance();
baseArtifactType.setArtifactType(getArtifactType().getApiType());
if (DocumentArtifactType.class.isAssignableFrom(baseArtifactType.getClas... |
890352a7-d98d-45ff-849a-ec4c8ba7aab2 | 2 | public boolean hasElement(T a)
{ if(this.a.equals(a))
{ return true;}
else if(this.next!=null)
{ return this.next.hasElement(a);
}
else
{ return false;
}
} |
d4c66ff8-37b6-404a-912f-c2e9d51b12b0 | 4 | public void handleWeaponStyle() {
if (c.fightMode == 0) {
c.getPA().sendFrame36(43, c.fightMode);
} else if (c.fightMode == 1) {
c.getPA().sendFrame36(43, 3);
} else if (c.fightMode == 2) {
c.getPA().sendFrame36(43, 1);
} else if (c.fightMode == 3) {
c.getPA().sendFrame36(43, 2);
}
} |
bc3cfcf4-8abf-4b89-abc8-919d08787035 | 9 | private void parsePacket()
throws MpegDecodeException, IOException
{
Statistics.startLog(PARSE_PACKET_STRING);
System.out.println("Parsing packet");
if(m_ioTool.getBits(24) != 0x1 )
{
Debug.println(Debug.ERROR, "Synchronization error in packet");
throw new Mp... |
b7f04a4b-4b42-4d9b-800f-a955f4ae25d0 | 9 | protected void saveEditDebates() {
String topicTitle = titleCDJtxt.getText()
, maxTurns = maxTurnsJcbx.getSelectedItem().toString()
, maxTime = maxTimeJcbx.getSelectedItem().toString()
, description = descriptionCDJtxa.getText()
, materials = "";
int teamASize = teamACDDLM.getSize()
, teamBSize ... |
8cb63066-21f3-4ace-8ac0-b641b3902d8c | 5 | public void rechacharamistad(String emisor, String nick){
try {
String queryString = "DELETE FROM peticionAmistad WHERE emisor=? and receptor=?";
connection = getConnection();
ptmt = connection.prepareStatement(queryString);
ptmt.setString(1, emisor);
... |
909e6751-2090-4d44-bb63-a47d1495506f | 3 | int bNNIRetestEdge( heap p, heap q, edge e, double[][] avgDistArray,
double[] weights, direction[] location, int possibleSwaps )
{
direction tloc;
tloc = location[e.head.index+1];
location[e.head.index+1] =
bNNIEdgeTest( e,avgDistArray,weights, e.head.index+1 );
if ( direction.NONE == location[e.head... |
2b05d31f-ba4b-4e30-b4a1-34a6140bdf25 | 4 | @Test
public void testCompPerformance() {
int size = 100000;
int[] inVals = Permutation.randomPermutation(size);
int testVal = inVals[size / 2];
TreeMap<Integer, Integer> treeMap = new TreeMap<Integer, Integer>(comp);
long t1 = System.currentTimeMillis();
for (int i =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.