method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d471b165-6336-4300-964f-33d1c1470531 | 9 | @Override
public int compareTo(Tache t) {
int c = _date.compareTo(t._date);
if (c != 0) return c;
boolean b1 = _begin.isNull(), b2 = t._begin.isNull();
if (b1)
c = b2 ? 0 : 1;
else
c = b2 ? -1 : _begin.compareTo(t._begin);
if (c != 0) return c;
b1 = _end.isNull();
b2 = t._e... |
9f065cd4-1076-42de-b413-d75bfe168a82 | 8 | @Override public void iterate(){
matcount += 1;
if(matcount >= mat){matcount = 0;
calculate(); }
if(ages){ if(active){ if(age == 0){age = 1;} else{age += 1;}}else{ age = 0;}
if(fades){ if( age >= fade){ purgeState(); age = 0;}}
if( age > 1023){ age = 1023; }state = agify(age);}
else{if(acti... |
418fe3c8-824a-4492-9687-68c30f3191c7 | 6 | public boolean wordBreak(String s, Set<String> dict) {
if(s==null){
return true;
}
boolean[] result = new boolean[s.length()+1];
result[0] = true;
for (int i=1;i<s.length()+1;i++){
result[i] = false;
}
for (int i=0;i<s.length();i++){
... |
6edf3fdf-7aec-4ba1-843c-1af7bde3b00f | 4 | private String doPost(String link, StringEntity entity) throws ConnectorException
{
HashMap<String, String> headers = new HashMap<String, String>();
headers.put(Constants.VCLOUD_AUTH_HEADER, authToken);
headers.put(Utils.ACCEPT_HEADER, Constants.XML_CONTENT_TYPE);
HttpResponse resp = RestClient.doPost(link,... |
a49e99b3-9964-4f38-98c5-6a25cf6509ab | 2 | @Override
public void informPairsOfNameChange() {
for(WorldCoordinate coord : getPairs()) {
SignalController ctrl = getControllerAt(coord);
if(ctrl != null){
ctrl.onPairNameChange(getCoords(), getName());
}
}
} |
2285f46f-7971-47b1-ae9d-4ba0259aacb4 | 3 | private static void loadSmileys() {
smileys = new HashMap<Pattern, String>();
try {
FileInputStream fstream;
fstream = new FileInputStream("smileys.conf");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((... |
12573dd4-8b60-4a1a-b638-e9ff10feaae5 | 7 | static public ArrayList<String> dpAlign(String str1, String str2) {
ArrayList<String> output = new ArrayList<String>();
output.add(str1);
output.add(str2);
if (Functions.isEmpty(str1) || Functions.isEmpty(str2)) return output;
ArrayList<String> tmp1 = Functions.explode(".",str1);
ArrayList<String> tmp2 = Fu... |
a9e1a2be-1d8b-485f-b44f-6f2c2a5a23e7 | 1 | public int find(
FindReplaceResultsModel model,
FileFilter fileFilter,
FileFilter dirFilter,
String startingPath,
String query,
boolean isRegexp,
boolean ignoreCase,
boolean includeSubDirectories
) {
// Setup the Crawler
crawler.setFileHandler(new FileSystemFindFileContentsHandler(query, model, i... |
1f331c2c-55fb-4414-8e0a-d51099950db7 | 3 | @Override
public void run() {
try {
pokemon = new Pokemon(db, moves, ability, id);
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(new File("db/pokemon/" + pokemon.name + ".poke")));
out.write(Pokemon.toXML(pokemon));
out.close();
} catch (SqlJetException e) {
e.printStackTrace(... |
2cb74a6c-2a50-42f3-a045-6f503e2760ac | 9 | public void buildClassifier(Instances data) throws Exception {
reset();
// can classifier handle the data?
getCapabilities().testWithFail(data);
data = new Instances(data);
data.deleteWithMissingClass();
if (data.numInstances() > 0 && !m_dontReplaceMissing) {
m_replaceMissin... |
d7c87fec-725d-43ef-bb9c-661db2efc13c | 8 | private void buildUpdateResources(){
updateResources = new Thread(new Runnable(){
public void run(){
while(true){
Boolean deleted = false;
for(int i = 0; i < clients.size() && !deleted; i++){
ClientInterface c = clients.get(i).getReference();
try{
Vector<String> resources = c.getRe... |
3cde8023-5c88-4976-8f8b-9c9d03345a5d | 7 | private void btnLuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLuuActionPerformed
//kiem tra input
if (txtMaKhoa.getText().isEmpty() || txtTenKhoa.getText().isEmpty() || txtVietTat.getText().isEmpty()) {
JOptionPane.showMessageDialog(this, "Chưa nhập đủ thông tin");... |
996914af-1315-4a89-999d-d37a30aabdea | 2 | public static List<AstronomicalObject> sortByName(List stm, int factor) {
List<AstronomicalObject> sorted = stm;
if (factor < 0) {
Collections.sort(sorted, (B, A) -> NAME_COMPARATOR.compare(A, B));
log.info("SortedByName descending :{}");
}
if (factor >= 0) {
... |
4047a2cc-f219-4176-af9b-ff89a8a4c933 | 3 | @Override
public void update() {
parent.actionCommand = ActionCommand.MOVE;//Theres nothing else this AI will do
Command command = null;
Command[] commands = Command.values();
while (command == null) {
Command possible_command = commands[Rand.nextInt(8)];
i... |
5ec6470b-1304-4bd8-ac5f-aed4683b4dc9 | 4 | public int getPlayerPositionOffset(PinochlePlayer p) {
int offset = 0;
Position position = p.getPosition();
switch(position) {
case North: offset = 2; break;
case East: offset = 1; break;
case South: offset = 0; break;
case West: offset = 3; break;
}
return offset;
} |
f56a9cf5-3c6f-42f6-b86b-6586c3c134da | 5 | @Override
protected void ismovelegal(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) throws HantoException {
// basic checks
super.ismovelegal(pieceType, from, to);
// Epsilon specific checks
// cannot place next to opposite color
if(from == null && turncount > 2) {
if(!super.... |
df383f1f-c7f6-4ed5-956d-f9f2eebd454e | 6 | public void makeDeclaration(Set done) {
if (constrAna != null)
constrAna.transform();
if (staticConstructor != null) {
new TransformConstructors(this, true,
new MethodAnalyzer[] { staticConstructor }).transform();
}
// If output should be immediate, we delay analyzation to output.
// Note that thi... |
7b26d29b-b2b9-49ef-8d81-fff3a11f31b0 | 7 | public Kmean(int height, int width, int dimension, Color[][] colorMap) throws MyExceptions {
MyNotPositiveNumberException.test("row + 1", height + 1);
MyNotPositiveNumberException.test("column + 1", width + 1);
MyNotPositiveNumberException.test("dimension + 1", dimension + 1);
if(colorMap != null) {
MyNotEqu... |
2e72afc0-4754-4764-80e2-5f9dd245f4c0 | 3 | public int [] getLanguages ()
throws IOException
{
synchronized (lock) {
if (!checkedStrings)
languages = ControlMessage.getLanguages (this);
checkedStrings = true; //if don't set this can get repetitive lookup failures? -- Wayne Westerman
}
i... |
5adf1420-ce8b-4766-ae87-11f187f30db4 | 8 | final public void Condition() throws ParseException {
/*@bgen(jjtree) Condition */
ASTCondition jjtn000 = new ASTCondition(JJTCONDITION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(ge... |
e69fa1d6-37b3-4e32-b253-ddcffd72e90a | 8 | public double decodeDouble(boolean implicit) throws Asn1Exception {
long intValue;
//
// There must be at least 2 bytes available
//
if (residualLength < 2)
throw new Asn1Exception("Attempt to read past end of stream");
//
// Validate the tag for an ... |
e788fda9-9612-46d6-9525-8171ce544403 | 3 | @Override
public int compareTo(WeightedPoint other)
{
if (other == null || this.getCost() > other.getCost())
return 1;
else if (this.getCost() < other.getCost())
return -1;
return 0;
} |
200dd719-34ec-4e42-af81-6252a50235a0 | 3 | public SondageReponse insert(SondageReponse obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("INSERT INTO SondageReponse (id_sondage,choix, nombreChoix,id) VALUES (?,?,?,?);");
pst.setInt(1, obj.getId_sondage());
... |
3f0cc5c3-a324-434c-a1fe-ae93cd246160 | 1 | private int numberOfRows() throws IOException {
Scanner scanner = new Scanner(filePath);
int i = 0;
while (scanner.hasNextLine()) {
i++;
scanner.nextLine();
}
scanner.close();
return i;
} |
27f97f30-ec41-4b30-bc8d-6e149862d480 | 6 | public void mouseMoved(MouseEvent e){
JList source = (JList) e.getSource();
int index = source.locationToIndex(e.getPoint());
Rectangle bounds = source.getCellBounds(index, index);
String model = source == distList ? "distributor" : "client";
if(index > -1 && bounds.contains(e.getPoint())){
... |
0cb1b608-cef7-4206-8576-1879d7ba0a2e | 4 | public static int[] insertionSortInt(int[] data, int firstIndex, int numValues)
{
int tempInt;
int i;
int j;
int k;
for (i=1; i<numValues; i++)
{
tempInt = data[firstIndex+i];
for (j=firstIndex+i; j>firstIndex; j--)
{
if (tempInt >= (data[j-1]))
break;
}
// Shift items... |
a7650427-0d95-43cb-b77f-25fdfbe8b82e | 3 | public static boolean ValidateSource(String xmlString, String xsdFile, StringBuilder message){
Source schemaFile = new StreamSource(new File(xsdFile));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = null;
try ... |
bb392ef7-8d0e-4a25-85d5-605b663417ac | 3 | private Object maybeReadSymbol(int cfaslOpcode) throws IOException {
switch (cfaslOpcode) {
case CFASL_KEYWORD:
// Keywords can be distinguished from Symbols by internal evidence
return readKeyword();
case CFASL_SYMBOL:
return readSymbol();
case CFASL_NIL:
return Cy... |
3c90151a-c290-406c-8136-dd446edb8e7e | 9 | public void update(float delta, int screenWidth, int screenHeight) {
// pre update all components
Iterator<ManagerComponent<T>> compoIterator = components.values().iterator();
while (compoIterator.hasNext()) {
ManagerComponent<T> mcomp = compoIterator.next();
if (mcomp.SHOULD_UPDATE)
mcomp.preUpdate(thi... |
81cfbb22-98b6-4329-8845-3a84dfe7b4a2 | 4 | public void rebondProjectilesMur(Projectiles proj) {
if ((proj.getPosition().getX() + proj.getBound().getX()) > module.getWidth()) {
proj.getPosition().setX(module.getWidth() - proj.getBound().getX());
module.rebond(proj, 'x');
}
if ((proj.getPosition().getY() + proj.getBound().getY()) > (module.getHeigh... |
939e8787-34ac-4aed-854a-6fbbaaaea5df | 3 | public ArrayList<Coordinate> getCoveredCoordinates() {
ArrayList<Coordinate> c = new ArrayList<Coordinate>();
if (horizontal) {
for (int i = 0; i < length; i++) {
c.add(new Coordinate(position.x + i, position.y));
}
} else {
for (int i = 0; i < length; i++) {
c.add(new Coordinate(position.x, posi... |
cb0a3266-d39c-43a4-9218-0f0ff4b5fc04 | 2 | public boolean delete(String filename) {
if (true == namenode.exits(filename)) {
List<String> chunk_uuids = (List<String> ) namenode.filetable.get(filename);
for (Object chunk_uuid : chunk_uuids) {
int chunkloc = (Integer) namenode.chunktable.get(chunk_uuid);
((DataNode)namenode.datanodes.get(chunkloc... |
d1c2e8f0-5a4d-4c30-9f45-ef2aacd92998 | 2 | public static int getPRuleID(String name)
{
for(int i = 0; i < numPRules; i++)
{
if(pRules[i].name().equalsIgnoreCase(name))
{
return i;
}
}
return -1;
} |
28fe91b0-bd16-49cf-ab5e-5ad8ed08a285 | 3 | @Override
public void performClientActions(int userID, Integer[] actions) {
GameObject player = gameObjects.get("PLAYER" + userID);
for (Integer integer : actions) {
switch (integer) {
case ACTION_SHOOT:{
GameObject ball = gameObjects.get("BALL");
int offset = 3;
if(player.isCloseTo(ball, offset)... |
a5a0a637-40b4-444d-b035-fb6d93713aad | 1 | public static String getHexString(byte[] b) {
String result = "";
for (int i = 0; i < b.length; i++) {
result += Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1);
}
return result;
} |
0e2c2849-0f16-466b-988c-f452bc7da2a4 | 8 | public Register getRegister(int index, String[] instArray) {
switch (instArray[index]) {
case "R0":
return registerFile.R0;
case "R1":
return registerFile.R1;
case "R2":
return registerFile.R2;
case "R3":
return registerFile.R3;
case "R4":
return registerFile.R4;
case "R5":
return regist... |
5c32eeef-819c-4393-ab59-55cbf67e45a2 | 7 | public void run() {
System.out.println( "Press [Enter] to process all config files or "
+ "enter a comma separate list of config files.\n\n" + "Available Files: \n\n" + getList() + "\n\n" );
Scanner scan = new Scanner( System.in );
String userInput = scan.nextLine();
i... |
0d9db4e9-397a-49e5-9870-bc199541ff21 | 7 | public void Lock() {
QNode myNode = currNode.get(); //get a new qnode
AtomicReference<QNode> localQueue = localQueues.get(((TestThread)Thread.currentThread()).getClusterId());
QNode myPred = null;
do {
myPred = localQueue.get();
} while (!localQueue.compareAndSet(myPred, myNode));
if (myPred !... |
7f98e0f2-60aa-4874-83b4-3094e1e76e73 | 9 | @Override
public MessageResponse upload(UploadRequest request) throws IOException {
if (!loggedIn) return new RefuseResponse();
FileServerProvider provider = serverManager.getServerProvider();
Queue<FileServerAdapter> nr = provider.getReadQuorum();
Queue<FileServerAdapter> nw = provider.getWriteQuorum();
lo... |
1e3a5ca1-a952-438d-b073-5e91f7ce5711 | 7 | private void formScreen(String action,
Connection database,
HttpSession session,
HttpServletRequest request,
PrintWriter webPageOutput)
{
int setNumber=0;
String setName="";
Ro... |
1d0ff8da-ea5d-4bf3-b8cb-56d8a76f1095 | 3 | public static void printMenu() throws NetworkException, Exception{
System.out.println("\n==== MENU ====");
System.out.println("1 - Set Parameters");
System.out.println("2 - Treat keywords of a folder");
System.out.println("3 - Quit");
int menuChoice = choiceMe... |
722fadfb-8518-4410-b0dd-67ead94144bb | 4 | public Type getCanonic() {
if (ifaces.length == 0 || (clazz == null && ifaces.length == 1))
return this;
if (clazz != null)
return Type.tClass(clazz.getName());
else
return Type.tClass(ifaces[0].getName());
} |
75ce0292-3a2c-4320-ae4b-8d30091010f4 | 7 | @Override
public void actionPerformed(ActionEvent evt) {
String cmd = evt.getActionCommand().toLowerCase();
if (cmd != null) {
if (cmd.equals("save")) {
save();
dispose();
}
if (cmd.equals("cancel")) {
dispose();
}
if (cmd.equals("disabled color")) {
showColorChooser(false, false);
... |
960ba39b-9344-4e25-a08b-6257a82c87e1 | 2 | boolean forwardCountCheck(final MethodEditor m, final int j, final int i,
final int bound) {
stackHeight = 0;
minStackHeight = 0;
for (int k = j + 1; k < i; k++) {
heightChange(m.codeElementAt(k));
if (minStackHeight < bound) {
return false;
}
}
return true;
} |
351c6886-bae0-44b1-8aee-60c4fa07ce4b | 3 | public boolean isSelected(int x, int y)
{
return x > getX()
&& x < getX() + getWidth()
&& y > getY()
&& y < getY() + getHeight();
} |
dd1b2af2-866d-421a-ab13-3fcc037c9ccb | 6 | public void modelPropertyChange(final PropertyChangeEvent evt) {
switch (evt.getPropertyName()) {
case AbstractController.PROPERTY_LEVEL_STATUS:
if ((boolean) evt.getNewValue() == true) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(500l);
} catc... |
0729d518-4485-4d7d-b117-6eb9de97af6b | 9 | public void next(int width, int height) {
rotationAngle = (rotationAngle+10)%360;
// scaleVal goes from 0 to 1, then 1 to 0, then starts over
scaleArg = (float)((scaleArg == 1) ? scaleArg - 0.1 : scaleArg + 0.1);
scale = (float)Math.cos(scaleArg);
movClubX += inc_club;
movDiamondX += inc_diamond;
movHeart += ... |
a5fb5b3d-76ce-4ff8-8044-a1680fb2b6c6 | 7 | public List<Namespace> getNamespacesInherited() {
if (getParentElement() == null) {
ArrayList<Namespace> ret = new ArrayList<Namespace>(getNamespacesInScope());
for (Iterator<Namespace> it = ret.iterator(); it.hasNext();) {
Namespace ns = it.next();
if (ns == Namespace.NO_NAMESPACE || ns == Namespace.XM... |
6fb771c6-3818-4b67-ab21-6c9f665d9d3d | 2 | public Float getFloat() {
Object gotValue=getValue();
if (gotValue != null) {
if (!Float.class.isAssignableFrom(gotValue.getClass())) {
throw new ClassCastException("don't know how to convert "
+gotValue.getClass().getName()+" to Float");
... |
ad2594b5-1728-43c9-8fcf-03f51f7ca139 | 6 | public void draw(){
//draw_grid();
for(Enemy e:Graphics.en){
Graphics.pen.drawImage(e.getMyImage(), e.getX()*40, e.getY()*40, 40, 40,0);
}
Graphics.pen.setColor(new Color(255,255,255));
int x=-1;
for (Square[] q2: Graphics.square_array){
x++;
int y=-1;
for (Square q: q2){
y++;
if ((... |
41949a01-1d86-440c-bfbf-8509e42c7bfa | 1 | public ClassPool registerClassLoader(ClassLoader ucl) {
synchronized (registeredCLs) {
// FIXME: Probably want to take this method out later
// so that AOP framework can be independent of JMX
// This is in here so that we can remove a UCL from the ClassPool as
// ... |
a1f9ac81-e99b-4bcf-82a3-e0554fba7569 | 3 | private void updateStateStep(List<Keyword> keywords, List<String> terms) {
RecipeLearningState nextState;
if (userSaidEnd(keywords)) {
nextState = new RecipeLearningState(RecipeLearning.RL_EXIT);
setCurrentDialogState(nextState);
createRecipe();
return;
}
if (terms.size() > 0) {
recipeSteps[numOfSteps] ... |
3d7ea9e3-bae0-49fd-bc98-3350bb9205a3 | 6 | private void factsAttributeListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_factsAttributeListValueChanged
//Redraw fact value combobox for new selected attribute, redraw information gain text field
if(factsAttributeList.getSelectedValue() != null){
factValue.rem... |
95aa79d3-45d4-4632-939f-5d9327a66032 | 1 | private void deMapATablaCompras(LinkedHashMap<Integer, Compra> compras) {
DefaultTableModel modeloCompras = ((DefaultTableModel) jTableCompras.getModel());
//No lo va a mostrar ordenado
for (Compra c : compras.values()) {
modeloCompras.addRow(new Object[]{c.getId(), c.getCantidad(), ... |
02be33bc-be09-4701-857b-8a67ce6f9965 | 0 | public QuadCurve2D getCurve(){
return curve;
} |
f78f3ac8-8d2e-4b12-9b6d-d93f1421a4e3 | 6 | private void fillFromArguments(String[] arguments) {
for (String string : arguments) {
if (!string.startsWith("--")) {
throw new IllegalArgumentException("illegal parameter: " + string);
}
String param = string.substring(2);
String params[] = param.split("=", 2);
boolean found ... |
591ecc33-3556-4499-90c7-58e1b430be9f | 7 | private void setLogLevel(final String level) {
if (null != level) {
switch (Integer.parseInt(level)) {
case 1:
LOGGER.setLevel(Level.FINEST);
break;
case 2:
LOGGER.setLevel(Level.FINER);
break;
case 3... |
eb3fea8a-0a9a-4261-ac79-5edaf8b18882 | 7 | public void removePiece(Tetromino current, int x, int y, int orientation){
boolean[][] tiles = current.getTiles();
int count = 0;
int width = current.getTiles()[0].length == 9 ? 3 : 4; // get width (2, 3, or 4) of piece
width = current.getTiles()[0].length == 4 ? 2 : width;
for(int row = 0; row < width; ++ro... |
56c7a98c-0763-42d1-ad08-ee064162ae85 | 2 | @Override
public boolean hasNext()
{
if (position >= addMaterialCommands.size() || addMaterialCommands == null) {
return false;
} else {
return true;
}
} |
d01a8a04-af72-4641-81a4-aa2c4edced69 | 8 | public static Document createTest(DocumentType docType) {
Document document = new Document(docType);
boolean needsAnswer = docType.equals(DocumentType.Test);
while(true){
switch(showMainPrompt()){
case 1:
document.add(new TrueFalse(needsAnswer));
break;
case 2:
document.add(new MultipleChoice... |
bfc6b9a1-9a65-4fbb-98ad-7160e9774cac | 9 | protected void addPiece(final Piece piece) throws InvalidMoveException {
if (piece.getType() < 4 && pieces[piece.getType()] == null) {
pieces[piece.getType()] = piece;
} else if (piece.getType() == Piece.RING_4 && isEmpty()) {
pieces[4] = piece;
} else {
throw new InvalidRingException();
}
if (pie... |
1823bbfd-e6a3-43da-88b5-18a15f516019 | 1 | public boolean operate(Boolean boolean1, Boolean boolean2) {
boolean b1 = (java.lang.Boolean) boolean1;
boolean b2 = (java.lang.Boolean) boolean2;
return b1 || b2;
} |
f75d8c2d-8ea8-4036-a1b2-4e0a2a885368 | 4 | private void doWork() {
System.out.println("DeleteWorker start to work!");
long start = System.currentTimeMillis();
for (String file : files) {
FileReaderUtils.del(file);
}
long end = System.currentTimeMillis();
long period = end - start;
System.out.println("Deleting files cost time in millis : " + per... |
17ab1658-52f6-4df0-a817-27ae63dd72ac | 1 | public ClassPool findClassPool(ClassLoader cl) {
if (cl == null)
return registerClassLoader(ClassLoader.getSystemClassLoader());
return registerClassLoader(cl);
} |
d2ee2f6f-b7fb-46b2-b0a4-a084067aa06f | 0 | public double getArea_surf(){
return area_surf = 0.43301*getEdge()*getEdge();
} |
f8150d4b-9dd3-4ab4-983c-6d248a6c2304 | 8 | public void putAll( Map<? extends Character, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Character,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Character,? extends Byte> e = it.next();
this.put(... |
2985e5ce-7c12-4558-bc4e-ebf4b21c8c7f | 2 | @Override
public String getColumnName(int c) {
String result;
switch (c) {
case 0:
result = "Word";
break;
case 1:
result = "Translation";
break;
default:
result = "id";
... |
aa2d5a07-b44f-4476-b685-22703fe9d34b | 2 | @SuppressWarnings("unchecked")
public void loadTreasureSpots() throws IOException, ClassNotFoundException
{
FileInputStream fis = new FileInputStream(TreasureHunt.getInstance().getDataFolder() + "/treasureLocations.xml");
if(fis == null) return;
ObjectInputStream ois = new ObjectInputStream(fis);
... |
bfffa404-5061-40a5-9b1c-0e428025e061 | 1 | public void preCalc() {
double weightedInput = 0;
List<Neuron> connected = previous.getNeurons();
for (int i = 0; i < previous.getNeuronCount(); i++) {
weightedInput += connected.get(i).getValue() * weigths.get(i);
}
stored = logSigmoid(weightedInput);
} |
a5acc6ed-9a39-4e2b-805a-180d38384ffe | 5 | private void shapeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_shapeComboBoxItemStateChanged
if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) {
switch (shapeComboBox.getSelectedItem().toString()) {
case "Sine":
synth.upda... |
52a66df7-725e-4f57-9ae4-13ec7ab8672e | 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 Parcela)) {
return false;
}
Parcela other = (Parcela) object;
if ((this.codparcela == null && other.codparcela ... |
5df835e4-3826-4e45-a972-095789a2cf4e | 2 | private static void doSaveImage(BufferedImage image, String fileName) {
String defaultName = "/Users/eck/Desktop/pentomino_icons/" + fileName + ".png"; // Name for file to be saved.
File selectedFile = new File(defaultName);
System.out.println("Saving image " + selectedFile.getAbsolutePath());
t... |
5bf42896-3190-48cd-8c07-c01e6dfa3037 | 5 | @Test
public void popBackTest() {
DoubleLinkedList l = new DoubleLinkedList();
DoubleLinkedList l1 = new DoubleLinkedList();
try {
l.pushFront(1);
l.pushFront(2);
l.pushBack(3);
assertEquals(3, l.popBack());
assertEquals(1, l.popBack());
assertEquals(2, l.popBack());
} catch (Exception e) {
... |
66f38d89-a857-479f-979e-fa58ad406f56 | 3 | @Override
public void run() {
long start;
long calcTime;
while(true) {
start = System.currentTimeMillis();
sc.tick();
sc.repaint();
calcTime = System.currentTimeMillis() - start;
if(TICK_TIME - calcTime > 0) {
try {
sleep(TICK_TIME - calcTime);
}
catch(InterruptedException ie) {}
... |
40eb59b9-9740-4a92-abde-80a4df3cdd6d | 6 | private boolean _jspx_meth_c_forEach_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_0 = (org.apache.taglibs.stand... |
a47f376b-c3fc-41f7-966a-275e428e8e32 | 7 | public void updateSheetRef( String newSheetName, String origWorkBookName )
{
try
{
// 20080630/20080708 KSC: Fixes for [BugTracker 1799] + [BugTracker 1434]
if( boundXti > -1 )
{ // has populate for transfer been called - should!
int newSheetNum = -1;
try
{
if( !boundName.equalsIgnoreC... |
59c076b8-5bea-4e9c-abd7-b3cb80563ccb | 7 | private CityNode[] getClosest(int numOfCities) {
CityNode[] nClosest = new CityNode[numOfCities]; //Array to hold the current leaders
int i, j; //Indexes declared here to save operations
// Iterate through all the nodes
for(CityNode n: graph.getGraph()){
// Make sure this isn't the current city
if (n... |
5f75b3ec-8d11-4741-a6fb-ed9094c359d0 | 7 | @Override
public void action() {
ACLMessage msg = myAgent.receive(msgFilter);
if (msg != null) {
if (msg.getConversationId() == null) {
logger.log(Level.WARNING, (teacherSymbol + ": ConversationId == null : sender: "
+ msg.getSender().getLocalName(... |
90af200d-34af-419b-a16b-ff8df710f669 | 4 | private void init(GUIContext container) {
this.buttons = new MouseOverArea[3];
this.draggable = true;
try {
this.buttons[0] = new MouseOverArea(container, new Image(
"data/img/butclose.png"), this.getX() + this.getWidth()
- 21, this.getY() + 3, new ComponentListener() {
@Override
public void... |
a156e022-14ba-46a2-9956-94f657fcfad4 | 8 | public static List<String> allComments(int imgId) {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
List<String> comments = new ArrayList<String>();
//String[] type = new String[1];
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(GET_... |
1f16705b-17e1-4875-aed6-d866fef33d6d | 6 | public void loadTiles(String directory, String[] tileList)throws IOException{
for(int i = 0; i <= tileList.length-1; i++){
FileReader fr = new FileReader(directory+tileList[i]);
BufferedReader br = new BufferedReader(fr);
int tileID = Integer.parseInt(br.readLine()); //this is the ID used in the loadMapP... |
48282274-661c-48b2-8bf2-fda997ce3a4c | 3 | public void carregarTabela(ArrayList<Processo> processo){
DaoProcesso pro = new DaoProcesso();
if(processo == null){
processos = pro.Consultar("");
for (int i = 0; i < processos.size(); i++) {
processos.get(i).getIdCliente();
... |
b9d2f13f-4ccf-4e33-aaa7-5df24543d1f8 | 1 | public void setShortMessageFonttype(Fonttype fonttype) {
if (fonttype == null) {
this.shortMessageFontType = UIFontInits.SHORTMESSAGE.getType();
} else {
this.shortMessageFontType = fonttype;
}
somethingChanged();
} |
334d0fdc-4f6b-4081-ba28-4ba2a3685145 | 2 | public Scheduler getScheduler(String every) {
logger.info(" Find scheduler for: " + every);
for (DateParser p: parsers) {
Scheduler s = p.parse(every);
if (s != null) {
logger.info(" Found: " + s);
return s;
}
}
logg... |
252c2077-ad03-4747-8b44-dc873f8fc5a8 | 6 | @Override
public void actionPerformed(ActionEvent event) {
if (!mIgnore) {
Object source = event.getSource();
if (source instanceof FontPanel) {
boolean adjusted = false;
for (FontPanel panel : mFontPanels) {
if (panel == source) {
Font font = panel.getCurrentFont();
if (!font.equals(U... |
336bab9b-e86b-4bd7-a5dd-6d3a56730d36 | 3 | @Override
public void save(int searchID, String naturalLanguage, JSONObject requests, Collection<Person> result){
JSONArray persons = new JSONArray();
for (Person person : result) {
JSONObject p = new JSONObject();
try {
p.put("firstName", person.getFirstName());
p.put("lastName", person.getLas... |
ab225ece-e638-475c-af22-345bfaa440b5 | 0 | public void setPerson(Person person) {
this.person = person;
} |
a5dc5196-48de-427a-9fcb-29482efcbc60 | 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... |
de02edd7-508b-447b-9ea9-f7364e32406d | 5 | public static List UniteLists(List x,List y){
List list = new ArrayList();
if(x.size()>y.size()){
for(int i =0;i<x.size();i++){
if(!y.contains(x.get(i))){
x.remove(x.get(i));
}else{
list.add(x.get(i));
}
}
}else{
for(int i =0;i<y.size();i++){
... |
2e3b68d4-c6d0-4317-bc93-1aad4b4b8525 | 8 | @Override
public boolean hasNext() {
// check if hasNext was called before to follow idempotency
if (hasNextCalled)
return hasNext;
hasNextCalled = true;
if (n == 0)
return false;
if (!started){
// if not started, generate first su... |
e9ff6120-0577-4952-ab1e-177ba849c8c1 | 7 | @Override
protected boolean appliesToRoom(Room R)
{
if((R.domainType()&Room.INDOORS)==Room.INDOORS)
return false;
switch(R.domainType())
{
case Room.DOMAIN_OUTDOORS_CITY:
case Room.DOMAIN_OUTDOORS_UNDERWATER:
case Room.DOMAIN_OUTDOORS_AIR:
case Room.DOMAIN_OUTDOORS_WATERSURFACE:
case Room.DOMAIN_OU... |
51db5360-aaaf-456a-bf2a-6024ea34abde | 4 | protected static void menuModifierMembre(){
System.out.println("Afficher (a) ou éditer (e) le profil ?");
System.out.print(">>>");
Scanner sc = new Scanner(System.in);
String choix = sc.nextLine();
if (choix.equals("a") || choix.equals("afficher"))
System.out.println("Voici votre profil : ");
System.out.... |
351a640d-d051-48c5-8ae7-867f734b4ae5 | 2 | public void sql_add_appointment() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Statement s = GUI.con.createStatement();
//CHANGE FUNCTION BASED ON HIERARCHY
if(GUI.Level == 1)
{
s.executeUpdate ("INSERT ... |
4c45d25d-c53d-4532-a5ae-2fc70a26724d | 9 | public void parserThreeGram() throws Exception {
Connection conn = JDBC.createConnection();
Ngram ngram;
int count = 0;
Token pre = new Token(null, null);
String preWordWithAttr = null;
while (list != null) {
preWordWithAttr = null;
count = 0;
for (int i = 0; i < list.size(); i++) {
curren... |
09a0846e-d474-4905-a068-40b571d846f6 | 5 | private static void updateMapModelAfterPicks(BotState state) {
List<Region> ourSpots = state.getVisibleMap().getOwnedRegions(state);
List<Integer> ourSpotsIDs = new ArrayList<>();
for (Region region : ourSpots) {
ourSpotsIDs.add(region.getId());
}
int pickPrefference = 1;
for (int pick : picks) {
if (... |
dbc25e58-48ff-4563-8fce-e2e6387d8369 | 8 | public void loadRootServers() throws com.grey.base.ConfigException
{
HashedMap<ByteChars, java.util.ArrayList<ResourceData>> newroots;
try {
newroots = config.loadRootServers(logger);
} catch (Exception ex) {
if (ns_roots.size()==0) throw new com.grey.base.ConfigException(ex, LOGLBL+"Failed to bootstrap ro... |
fc6d82e0-8b2d-4071-9e47-5a8364d31787 | 8 | private MailinglistFilter(Element includeNamiResult)
throws ConfigFormatException {
// Lese Tätigkeiten
for (Element taetigkeit : includeNamiResult
.getChildren("taetigkeit")) {
String id = taetigkeit.getAttributeValue("id");
tr... |
cd1c79ca-4791-4748-a1e8-5b87b5c576b0 | 1 | @Override
public void setTransient(Registry rg) {
registry = rg;
placeableManager = rg.getPlaceableManager();
buildingImage = registry.getImageLoader().getImage(standardImage);
buildingImage = registry.getImageLoader().changeToGrayscale(buildingImage);
canPlaceImage = regis... |
3edb6189-d1fc-4157-9bd0-e8f506ce85a6 | 3 | @Override
public Dimension getPreferredHeaderSize() {
int width = 0;
int height = 0;
if (mShowHeader) {
for (TreeColumn column : mColumns) {
Dimension headerSize = column.calculatePreferredHeaderSize(this);
width += headerSize.width;
height = Math.max(headerSize.height, height);
}
int column... |
9f69591d-d371-418d-8faa-f60c94263e12 | 1 | public synchronized void deleteWay(int pos, long wayId){
if (ways.size()>pos)
ways.get(pos).remove(wayId);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.