method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
57d9d82e-b1dd-4b9b-b253-221950f4c83a | 4 | public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc="main()">
try {
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch (InstantiationException ex) {
ex.printS... |
64cf53cf-78a2-4166-9a0e-e21e06d98143 | 0 | public String getVersionName() {
return this.versionName;
} |
c51b2134-c6e4-423b-b2e3-96c9dd74df75 | 7 | private void writeTerm(int fieldNumber, byte[] termBytes, int termBytesLength)
throws IOException {
if (!isIndex && bloomFilterEnabled) {
int keyBuffer = setKeyBuffer(fieldNumber,termBytes,termBytesLength);
if (keyBuffer > 0) {
bloomFilter.addBytes(bloomKeyBuffer.array(), 0, keyBuffer);
}
}
//... |
3f0f0658-f746-49b7-b552-a654fdca5fff | 4 | public void lisaaLohkoonLaskutoimitus(Laskutoimitus lisattava)
throws IllegalArgumentException, IllegalStateException {
if (lisattava == null) {
throw new IllegalArgumentException();
}
if (seuraavaArvollinen == null) {
throw new IllegalStateException();
... |
336950fc-9e07-46cf-9f3f-869dcc1b5c04 | 5 | private void addPlayerExp(CommandSender s, String[] a) {
if(!checkCondition(s, a, "addexp", "Exp"))
return;
String jobName = McJobs.getPlugin().getLanguage().getJobNameByLangName(a[2], getPlayerLanguage(s));
String oldRank = Leveler.getRank(PlayerCache.getJobLevel(a[1], jobN... |
1ff1bfc3-6147-4969-9ba5-0c25600fbe93 | 3 | private String getGroupsOutput(Pattern pattern, String testStr) {
String result = "";
Matcher matcher = pattern.matcher(testStr);
if(matcher.find()) {
for(int i=0; i <= matcher.groupCount(); i++) {
int startIndex = matcher.start(i);
int endIndex = matcher.end(i);
String groupSt... |
afedbb31-e55e-4549-ad12-feeaae43f76a | 4 | @Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... |
faf8e5a1-49bc-4c67-ac6f-2f062d04dcba | 0 | public void driver() {
System.out.println("bwm drive");
} |
acf6132f-d905-47ae-8d03-92e6b10ceeea | 1 | public static void main(String[] args) {
// TODO Auto-generated method stub
int port = 2223;
if (args.length == 1) {
System.out.println(args[0]);
port = Integer.parseInt(args[0]);
}
ServerListener sl = new ServerListener(port);
sl.start();
System.out.println("Server is listenning on port: " + port);... |
bbef7cde-a192-4fa4-9c30-b7771b824fc9 | 2 | public int autenticar(String usuario,String senha) throws ErroValidacaoException, SQLException{
PreparedStatement comando = null;
try{
comando = conexao
.getConexao().prepareStatement("SELECT id FROM usuarios_sistema WHERE usuario = ? AND senha = ?");
comando.... |
d53eb47d-9939-4da3-95eb-83e32ab86526 | 1 | public void cancelTask() {
try {
abort();
} catch (java.io.IOException e) {
throw new RuntimeException(e);
}
} |
04364892-06ff-405f-bdf6-cc942c12f4f0 | 0 | public float getB() {
return b;
} |
d2fd5ae4-d0c5-4c1d-b90f-50e7b9493f1b | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Tripoint point = (Tripoint) obj;
return x == point.x && y == point.y && z == point.z;
} |
b19fddef-3f92-4ece-bdee-72f68b8c55d7 | 5 | public static void setRequerimientos(GrafoTabla Grafico, ArrayList <Requerimiento> ListaRequerimientos, ArrayList <Camion> Camiones){
int nodo_carga_aux;
int posicion;
Requerimiento req_aux;
while(Grafico.getNumeroDisponiblesCarga()>0){
for(int i=0;i<Camiones.size();i++){
... |
5c25f50f-5cb6-4933-ad5b-4443016ca77e | 7 | public boolean pick(Pickable i) {
if (this.canPick(i)) {
if(i instanceof Equipable) {
if(!this.itemsList.add((Equipable)i)) {
return false;
}
}
if (i.getModifier() != null) {
removeTerrainChanges(getBox());
setAttibutes(i.getModifier().adjustAttrs(getAttributes()));
applyTerrainC... |
eb4789a7-85ac-41c6-9d04-d9604defcba6 | 5 | @Override
public ZemObject eval(Interpreter interpreter) {
List<Node> statements = ((BlockNode)switchBlock).getStatements();
ZemObject defaultValue = null;
for (Node statement : statements) {
if(statement instanceof CaseNode){
//System.out.println("ohoho" + ((CaseNode)statement).getVar());
ZemObject v... |
a38dbc38-bee9-4e23-a3f0-8a954d86829f | 1 | public TreatmentMeta getTreatmentMeta(int index){
try{
return treatmentMeta.get(index);
} catch (IndexOutOfBoundsException e){
}
return null;
} |
fc958fc6-a191-45a2-8db9-177f534d0891 | 6 | public final void setSliderPercent(int sliderIndex, double sliderPercent)
{
// Check sliderIndex is within array bounds,
// if not create exception.
if (sliderIndex < 0 || sliderIndex >= sliders.size())
{
Tools.errorWindow(new IndexOutOfBoundsException(
"The index you passed into the '... |
bb567fe9-5e3b-4a78-b63d-d008f42ee855 | 4 | @Override
public void start(final Stage stage) throws Exception {
stage.setMinWidth(800);
stage.setMinHeight(500);
stage.getIcons().add(new Image(getClass().getResourceAsStream("/bdl/icons/BlueJ_Orange_64.png")));
new LabelGrabber();
//Allow user to specify their own file
... |
ce32c50f-1ca1-4ef7-8432-b341a0a0845a | 1 | private static SessionFactory buildSessionFactory() {
try {
Configuration config = new Configuration(). addResource("/com/growup/time/manager/persistence/database.cfg.xml");
ServiceRegistryBuilder registryBuilder = new ServiceRegistryBuilder();
registryBuilder.applySettings(config.getProperties());
regist... |
1ad493eb-b43b-4707-ad79-0c6b63c18703 | 3 | CPColorFloat sampleColor(int x, int y, int dx, int dy) {
LinkedList<CPColorFloat> samples = new LinkedList<CPColorFloat>();
CPLayer layerToSample = sampleAllLayers ? fusion : getActiveLayer();
samples.addLast(new CPColorFloat(layerToSample.getPixel(x, y) & 0xffffff));
for (float r = 0.25f; r < 1.001f; r ... |
d44cc308-5623-428c-a2ae-504434c43f13 | 5 | private ListItr(int index) {
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
}
if (index < (size >> 1)) {
next = head.next;
for (nextIndex=0; nextIndex<index; nextIndex++) {
next = next.next;
}
} else {
next = tail;
fo... |
ecabe069-dceb-483b-b76c-bf3a4de41a46 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
590b16da-f921-48ca-a73e-4c790b7e9261 | 0 | public String toString(){
return new String("Put Count: "+mPutCount+" , Eviction Count"+mEvictionCount+" , Hit Count "+mHitCount+" , Miss Count"+mMissCount);
} |
15e87662-3ebb-48b5-8c52-458d1c92d077 | 6 | public boolean matches( Font f )
{
return (fontName.equals( f.fontName ) && (dyHeight == f.dyHeight) && (bls == f.bls) && (getColor() == f.getColor()) && (sss == f.sss) && (uls == f.uls) && (grbit == f.grbit));
} |
e25eebc5-1bff-4a59-96fa-62e4e8b721c2 | 6 | private void sort(int column) {
if(table.getItemCount() <= 1) return;
TableItem[] items = table.getItems();
String[][] data = new String[items.length][table.getColumnCount()];
for(int i = 0; i < items.length; i++) {
for(int j = 0; j < table.getColumnCount(); j++) {
data[i][j] = items[i].getText(j);
}
}
... |
93bce9fb-7bec-40fe-93cb-6bb1843d7656 | 7 | @Override
public void create(DataObject obj) throws SQLException {
if(!(obj instanceof ProductDO))
throw new IllegalArgumentException("Tried to save a non StorageUnit in " +
"DBStorageUnitDAO");
PreparedStatement stmt = null;
Statement keyStmt = null;
ResultSet keyRS = null;
SQLException exception = ... |
66c44475-c8bd-4679-8d41-983a837d8ac0 | 8 | public void run()
{
DataInputStream ds = new DataInputStream(this.inFile[fileCount]);
try {
while (!suspending) {
String line = ds.readLine();
// See if its the last file before terminating
if (line == null) {
fileCount++;
if(fileCount >= this.inFile.length) {
break;
... |
c7099b32-0c4d-4a61-8501-d58baba877e0 | 0 | @Override
public Integer getServerPort() {
return serverport;
} |
2cb7b0e8-49e3-41c1-a848-ff0396f62808 | 4 | private void bubbleDown(int pos) {
int c1Pos = 2*pos + 1;
int c2Pos = 2*pos + 2;
int maxPos = c1Pos;
if(c1Pos <= len - 1) {
if(c2Pos <= len - 1) {
if(a[c1Pos] < a[c2Pos]) maxPos = c2Pos;
}
if(a[maxPos] > a[pos]) {
swap... |
c715a69d-0a0b-4d17-927b-82f9425c4530 | 2 | public void add_message(int type,int Line_no,int error_code,String extras){
if(type==1)wrncnt++;
if(type==2)errcnt++;
messagequeue.add(new Error(type,Line_no,error_code,extras));
} |
62b446a6-52a0-4902-aad3-1c6f47d4027c | 0 | public static void main(String[] args) {
Context cx = new Context();
cx.strategy = new ConcreteStrategyA();
cx.doSomething();
} |
f7ecb562-9f68-4534-aebe-bba023d2b6b6 | 9 | Expression parsePrimaryExpression() throws SyntaxError {
Expression expressionAST = null; // in case there's a syntactic error
SourcePosition expressionPos = new SourcePosition();
start(expressionPos);
switch (currentToken.kind) {
case Token.INTLITERAL:
{
IntegerLiteral ilAST = pars... |
54ac6ceb-d69b-42d9-bc83-f782562932b9 | 3 | @Test
public void testOneDiff() {
B newB = new B();
newB.id = 3;
newB.name=targetB.name;
final String newAddr = "here am i, alone on a hill!";
newB.addr = newAddr;
int expected = 2; // id and addr differ
final List<DiffField> diffs = DiffObj.diffObj(targetB, newB);
assertEquals(expected, diffs.size());... |
b3e288e7-d8fb-418d-80f8-22a081dfdb90 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
eb33d024-06b9-4055-8204-25154d71b9dd | 9 | public void userInput() throws NewCustomException {
FlightDTO dto = new FlightDTO();
boolean validate = true;
String input;
String choice= "y";
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));
do {
System.out.println(Constants.WELCOME_MESSAGE);
do {
... |
ae472b88-d730-4e25-a0e1-00d7e571cd9c | 7 | public static boolean insertCategory(String catName, String catDescription)
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
boolean result=true;
try{
String sql="INSERT INTO category(category_name,description) VALUES (?,?)";
con=ConnectionPool.getConnectionFromPool();;
ps=con.pr... |
781efa0e-4dd6-4975-a1a8-8caf7cd865ca | 8 | @Override
public byte[] toBytes(Object value) {
Date date = (Date)value;
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
long result;
switch (precision) {
case DATETIME:
result = calendar.getTimeInMillis();
b... |
9f6d6033-69a6-4255-87a7-471746919df3 | 2 | public static String arrayToDelimitedString(Object[] arr, String delimiter) {
StringBuilder builder = new StringBuilder();
for (int index = 0; index < arr.length; index++) {
if (index > 0) {
builder.append(delimiter);
}
builder.append(arr[index]);
}
return builder.toString();
} |
86a42387-7dee-444a-b38c-cba7e61598b0 | 2 | public void compileShader()
{
glLinkProgram(program);
if(glGetProgram(program, GL_LINK_STATUS) == 0)
{
System.err.println(glGetProgramInfoLog(program, 1024));
System.exit(1);
}
glValidateProgram(program);
if(glGetProgram(program, GL_VALIDATE_STATUS) == 0)
{
System.err.println(glGetProgr... |
c3bea332-de28-4bb1-82f4-38b82965b568 | 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... |
053c9fbd-998e-4756-8a37-bcc38c8942ea | 1 | public EnemyWave(Enemy enemyPrototype, int nrOfEnemies, double groupActivationTime, double activationTime) {
for (int i = 0; i < nrOfEnemies; i++) {
double totalActivationTime = i*activationTime;
enemiesInCurrentWave.add(i,new Enemy(enemyPrototype, totalActivationTime));
}
... |
2dfa2796-6ea9-43a6-afd5-faeb92b66691 | 4 | */
public void insertCols( int first, int count )
{
ReferenceTracker.updateReferences( first + 1,
count,
this,
false ); //shift or expand/contract ALL affected references including named ranges
// s... |
021d69ac-f6d0-4f72-a8cf-937d999a8001 | 8 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent e){
Player p = e.getPlayer();
if (e.getClickedBlock() == null || e.getItem() == null) return;
if (p.hasPermission(plugin.getAdminPermission())){
if (e.getItem().equals(KotHPlugin.getKotHCreationTool())){
if (e.getAction() == Action.RIGHT_CLICK... |
697d889c-78e4-4eed-85ac-36acf7b41e29 | 0 | public void setRYAxisDeadZone(float zone) {
setDeadZone(ryaxis,zone);
} |
cf404f40-6dfe-4087-b9a8-08a71aecb3e1 | 8 | private synchronized void updatePendingMerges(int maxNumSegmentsOptimize, boolean optimize)
throws CorruptIndexException, IOException {
assert !optimize || maxNumSegmentsOptimize > 0;
if (stopMerges)
return;
// Do not start new merges if we've hit OOME
if (hitOOM) {
return;
}
... |
7966fe3a-bbaf-4107-8953-d5b9212eabc2 | 1 | @Override
public void execute(VirtualMachine vm) {
if (onOrOff.equals("ON")) {
vm.setDumping(true);
} else {
vm.setDumping(false);
}
} |
29ca485c-bd19-473a-8854-f23a8124c35b | 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... |
1e6145d1-2cb6-4b52-be08-1dd91fa8452d | 5 | public static double[] doLinearRegression(double[][] args) //input double[0]=array of day number
{ //input double[1]=array of prices
double[] answer = new double[3];
int n = 0;
double[] x = new dou... |
10769de5-1209-4f12-aea2-ef332c4d473e | 4 | public void popularCmbDepartamento() {
ArrayList<String> Departamentos = new ArrayList<>();
DepartamentoBO depBO = new DepartamentoBO();
if (userLogado.getTipo().equals("Diretor")) {
try {
Departamentos = depBO.ComboBoxDepartamentos();
} catch (SQLExcepti... |
8f53d2a4-1836-47eb-b616-836ba5922954 | 8 | public static RealInterval midpoint(RealInterval x) {
RealInterval z = new RealInterval();
z.lo = (x.lo + x.hi)/2.0;
z.hi = z.lo;
if ((Double.NEGATIVE_INFINITY < z.lo) &&
(Double.POSITIVE_INFINITY > z.lo)) {
return(z);
}
else if ((Double.NEGATIVE_INFINITY == x.lo)) {
if (x.h... |
14ba14bd-19d8-483e-bc7f-b4974cbc7541 | 9 | public static void main(String[] args) {
SongInfo si;
String openlpPath = "";
String crPath = "";
String crDataPath = "";
String crPassword = "";
System.out.println("AutoCopyReport v.1.00.00");
System.out.println("(c) 2014 Volksmission Freudenstadt");
System.out.println("Author: Christoph Fischer ... |
6d00f993-1c6b-4383-91ec-395fa87c5d14 | 9 | public static void main(String[] args)
{
lastPlayedMove = new Move();
int NumberofMoves = 0;
int boardEmptyPieces=Integer.valueOf(args[0])*Integer.valueOf(args[0]);
System.out.println("Referee started !");
try{
P1 = (Player)(Class.forName(args[1]).newInstance());
P2 = (Player)(Class.forName(args[2]).ne... |
de78e82c-99c9-4e09-88a6-4e35bb9d9317 | 7 | private void checkEscapeButton() {
if (input.back()) {
if (this instanceof BookScreen
|| this instanceof MinigameSelectorScreen
|| this instanceof BurndownScreen
|| this instanceof ScoreScreen
|| this instanceof VisionEn... |
1d3b2ff8-33bd-48ff-abda-4cd265114bff | 9 | public double[] getNumericLabelsFromMethod(Object o)
{
LOG.trace("Retrieving double[] for method based labels");
if(this.numericLabelMethods == null)
{
this.initNumericLabelMethods();
if(this.numericLabelMethods == null || this.numericLabelMethods.size() == 0)
{
LOG.trace("No numeric label metho... |
8c4d0922-e1fd-46ea-be2c-f67ff6cf25b0 | 7 | public void run() {
// to loop until LOGOUT
boolean keepGoing = true;
while (keepGoing) {
String message = "";
try {
// diavazoume to public key to client
PublicKey clientPublicKey = (PublicKey) sInput.readObject();
cm = (ChatMessage) sInput.readObject();
byte[] receivedMsg = Bas... |
7903a593-075a-4a55-9c98-aefa97f6eb72 | 5 | private static String chunking_and_replace(String[] complete_sentence_tokens, int start, int end, String replacement) {
String element = "";
for(int i = 0; i < complete_sentence_tokens.length; i++){
if(i < start || i > end){
element += complete_sentence_tokens[i];
if(i < complete_sentence_tokens.length){... |
51853e89-d017-4461-8aa1-787d06f4f417 | 5 | private static byte med3(byte a, byte b, byte c) {
return (a < b) ? (b < c ? b : a < c ? c : a) : (b > c ? b : a > c ? c
: a);
} |
bed45f6d-9fb4-44cc-83ea-b525887d3b07 | 7 | private static Board readOneSolution(BufferedReader br, int lines, boolean headerPresent) throws IOException {
if( headerPresent ){
String header = br.readLine();
if( header == null ) return null;
}
String line = br.readLine();
if( line == null ) return null;
List<String> strings = new ArrayList<String>... |
cca66f4b-cf3c-4647-89b5-3f1c40663901 | 7 | public int[] twoSum(int[] numbers, int target) {
HashMap<Integer, LinkedList<Integer>> h = new HashMap<Integer,LinkedList<Integer>>();
int len = numbers.length;
int in1=0,in2=0;
int[] in = new int[2];
for(int i=0;i<len;i++){
if(!(h.containsKey(numbers[i]))){
... |
583a406f-355e-45ca-97c3-b1436c6672d7 | 6 | public int find(final String uri, final String name, final int start) throws NullPointerException {
if (start < 0) return -1;
final boolean useUri = uri.length() != 0, useName = name.length() != 0;
for (int i = start, length = this.length(); i < length; i++) {
final BEXNode node = this.get(i);
if (useUri &&... |
a7f99453-d8f1-451a-ada3-fbe815cf9cd6 | 2 | public void testGetPartialValues() throws Exception {
TimeOfDay tod = new TimeOfDay();
int[] expected = new int[] {1, 2, 3, 4};
int[] actual = ReadablePartialConverter.INSTANCE.getPartialValues(tod, new TimeOfDay(1, 2, 3, 4), ISOChronology.getInstance(PARIS));
assertEquals(true, Arrays.e... |
5f00ed0f-35db-4ea7-9813-bfa09c44203b | 5 | @SuppressWarnings("static-access")
private void updateVisibleSelectedPlaylist() {
if(!LockedPlaylistValueAccess.lockedPlaylist) {
String[] splitStringTotal = null;
String[] splitStringCurrent = null;
splitStringTotal = getTrackLength().split(":");
splitStringC... |
d3839cce-5cb3-4f99-a5e6-21bc6d2d7603 | 9 | private int toInt(String string) {
int result = 12;
switch (string.charAt(0)) {
case 'A':
result += 0;
break;
case 'B':
result += 2;
break;
case 'C':
result += 3;
break;
case 'D':
result +... |
27333199-177c-446a-bda8-27113d96791a | 6 | public static int getPrecedence(Character someOperator)
{
char ch = someOperator.charValue();
int precedence = 0;
switch(ch)
{
case '^':
precedence = 5;
break;
case '*':
case '/':
... |
8b6c9136-f1c4-4bf4-ac81-26964b67e215 | 7 | public boolean solveSudokuRec(char [][] board, boolean [][] rows, boolean [][] cols, boolean [][] cells, int level){
if(level == 81) {
return true;
}
int i = level / 9;
int j = level % 9;
if(board[i][j] != '.') {
return solveSudokuRec(board, rows, cols, ce... |
74f5c472-097e-4063-bbad-34e569244daf | 3 | private String getFormatedFileSize(File file) {
String byteWord = "bytes";
String[] unitArray = {byteWord, "K" + byteWord, "M" + byteWord};
double size = (double)file.length();
int unitIndex = 0;
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(3);
if (size > KILO_... |
837f5e79-b5bf-4265-8c08-29ef85cf3c19 | 6 | public void body()
{
// find out ids for entities that are not part of simulation network
// topology, such as GIS, GridSimShutdown and GridStatistics
int gisID = GridSim.getGridInfoServiceEntityId();
int statID = GridSim.getGridStatisticsEntityId();
int shutdownID = GridSim.... |
dbc5e512-434f-4a98-97ad-588a2aed9a75 | 4 | private void traverse(TreeNode node, int level) {
if(node.left == null && node.right == null) {
max = Math.max(max, level);
return;
}
TreeNode left = node.left;
TreeNode right = node.right;
if(left != null) {
traverse(left, level + 1);
}
if(right !... |
9b89b9f4-47e0-4b28-8d18-b73e7f445836 | 8 | @Override
public void run() {
while(true){
if(knowTracker && isReady){
if(!buscou && changePanel){ //nao fez uma busca ainda
telaInicial = new GUITelaInicial(this, jFrame.getWidth(), jFrame.getHeight(),GUITelaInicial.CONECTADO);
jFrame.getC... |
5532e3cd-2520-4ce8-885e-2c8efd70f468 | 6 | public static void showSlot(String hostname, String[] words) {
if (words.length == 2) {
if (Functions.isNumeric(words[1])) {
int slot = Integer.parseInt(words[1]);
if (slot > 0 && slot < 11) {
String query = "SELECT `serverstring`,`slot` FROM `server`.`save` WHERE `slot` = ? && `username` = ?";
t... |
811cbc03-c757-4727-ba34-3604f7455680 | 5 | @Override
public Set<Integer> selectIndices(Population population, int numberOfPrograms) {
if (numberOfPrograms > population.getSize()) {
numberOfPrograms = population.getSize();
}
List<Double> fitnessList = population.getFitnesses();
List<Double> normalizedFitnessList = new ArrayList<Double>();
Random ra... |
754a613e-a2f9-4a33-9c48-2fa12719aa74 | 8 | public static String crypt(BigInteger n,BigInteger e, String msg1)
{
int fp=0,lp=32,j=0,i,c=0;
BigInteger encod[]=new BigInteger[1000000];
BigInteger encry[]=new BigInteger[1000000];
String binary="";
String coded=new String();
String sixteen[]=new String[1000000];
String str="";
... |
4edc9961-816b-401e-ab31-faed955878ea | 2 | private int getGenderCount(Gender gender) {
int count = 0;
for (String[] item : data) {
if (item[GENDER_INDEX].trim().equals(gender.value())) {
count++;
}
}
return count;
} |
42da564f-12dc-4881-a4c7-a2550637f37c | 5 | void createReviewPage()
{
composite = new Composite(shlNewAccount, SWT.NONE);
composite.setLayout(new FormLayout());
Label lblHeresAnOverview = new Label(composite, SWT.NONE);
FormData fd_lblHeresAnOverview = new FormData();
fd_lblHeresAnOverview.right = new FormAttachment(0, 613);
fd_lblHeresAnOverview... |
fd040f7b-8967-45ea-8b0b-d15ba4252841 | 1 | protected void fireServerStop(ServerStopEvent evt) {
//..if server is stop, setup to all calls Disconnect = true
for (IRemoteCallObject rco : sync.values()) {
rco.setDisconnect(true);
synchronized (rco) {
rco.notifyAll();
}
}
sync.clear();
conns.clear();
} |
d6a0f540-068a-4ba5-a9f4-d14b6c503ca4 | 8 | final IAMListingBuilder _encodePROP_(final BEXGroupPool pool, final int prop) {
final List<BEXGroupItem> groups = pool.items;
final int length = pool.length;
final int[] value = new int[length];
int index = 0;
for (final BEXGroupItem group: groups) {
final List<BEXItem> items = group.items;
final... |
9d8e2d3a-46d9-4d48-96aa-5dcbfbd5c266 | 4 | public Direction getOppositeDirection() {
switch (this) {
case UP:
return DOWN;
case DOWN:
return UP;
case RIGHT:
return LEFT;
case LEFT:
return RIGHT;
default:
throw new IllegalStateException();
}
} |
16911028-7583-42c2-855b-e98631c877c9 | 3 | public Telefone Abrir(int id) {
Telefone tmp = null;
try {
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM telefones WHERE id = ? "
+ "AND ativo = 1");
comando.setInt(1, id);
ResultSet consulta =... |
fa5f1ab2-3ffa-4f07-8dcb-584f7a9063e3 | 4 | private ArrayList<Integer[]> getNearbyRegions(double[][] array, int x, int y) {
ArrayList<Integer[]> a = new ArrayList<Integer[]>();
if (x - 1 >= 0)
a.add(new Integer[] { x - 1, y });
if (x + 1 < array.length)
a.add(new Integer[] { x + 1, y });
if (y - 1 >= 0)
a.add(new Integer[] { x, y - 1 });
if (y... |
24d2f975-6cae-4f51-ab02-6a10e59ef464 | 6 | public boolean cutoffPartialMatchP(boolean traceP) {
{ PartialMatchFrame self = this;
{ double score = self.positiveScore;
double cutoff = self.dynamicCutoff;
boolean cutoffP = false;
if ((score == Stella.NULL_FLOAT) ||
((cutoff == Stella.NULL_FLOAT) ||
(cuto... |
53f25204-732e-4a3d-ad6d-1aad12541d8f | 2 | public void testCycSymbol() {
System.out.println("\n*** testCycSymbol ***");
CycObjectFactory.resetCycSymbolCache();
assertEquals(CycObjectFactory.RESET_SYMBOL_CACHE_SIZE, CycObjectFactory.getCycSymbolCacheSize());
String symbolName = "WHY-ISA?";
CycSymbol cycSymbol = CycObjectFactory.makeCycSymbol(... |
25df999e-75c9-4d3a-ac8c-8452dbf6990c | 3 | public void addRow(Component ...components)
{
Component[] newRow = new Component[columns.length];
for(int i = 0; i < columns.length; i++) {
if(i >= components.length)
newRow[i] = new EmptySpace(1, 1);
else
newRow[i] = components[i];
}
... |
b1199d61-1c1d-431f-bb37-df0324494d9d | 8 | protected void calcSpValue() {
double t = 0.0;
double result = 0.0;
int i, j, k;
double[] x = new double[Def.N];
double[] y = new double[Def.N];
try {
t = Double.parseDouble(spTTextField.getText());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, ErrMessage.T_WRONG);
spTT... |
fd41de7d-f421-4181-bc98-e0224a3dfdbd | 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 Fonction)) {
return false;
}
Fonction other = (Fonction) object;
if ((this.id == null && other.id != null) || (... |
c573dc34-f0c3-4441-9f22-ff76e0b5efce | 0 | public int getSupplierCode() {
return supplierCode;
} |
4795a9b6-3442-4a6c-9506-7488b9d9002c | 4 | public static void main(String[] args){
//most # of digits is 6 aka /100,000
int largest = 0;
//multiply all 3 digit numbers togeather, and test them if they are a palindrome, then compare the palindrome numbers
for(int i = 100; i<=999; i++){
for(int j = 100; j<= 999; j++){
int mynum = i*j;
if(isPal(... |
ae16051d-f5e6-472f-9a7b-2a09fc012a9c | 5 | public final FEMFormatter putFrame(final Iterable<? extends FEMValue> params) throws NullPointerException, IllegalArgumentException {
final Iterator<? extends FEMValue> iter = params.iterator();
if (iter.hasNext()) {
FEMValue item = iter.next();
if (iter.hasNext()) {
this.putIndent().put("(").putBreakInc(... |
b1ab5d3a-1a02-410b-b201-96c270aabf04 | 8 | private void closeAll() throws IOException
{
if(in1 != null)
in1.close();
if(in2 != null)
in2.close();
if(out1 != null)
out1.close();
if(out2 != null)
out2.close();
if(p1 != null)
{
try
{
p1.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
if(p2 != null)
... |
6febc672-91e7-4e15-b6f1-cb247bd190ca | 8 | public void rebuildDataTable() {
if (document == null)
return;
// set current processing table
DataTable table = tableUI.getData();
table.reset();
int index;
Color color;
// get root element 'table'
Element root = document.getDocumentElement();
// set selection bar width
String selectionType ... |
51cdd10e-3086-44f9-ba64-a44bb3814d28 | 4 | public static void countSort_useTempArray (int[] array, int k) {
int[] temp = new int[array.length];
int[] count = new int[k];
for (int i = 0; i < array.length; i++) {
count[array[i]]++;
}
for (int i = 0; i < k - 1; i++) {
count[i + 1] += count[i];
}
for (int i = array.length - 1; i >= 0; i--) {
... |
d136a1d3-a11d-416a-929e-268ed1c71639 | 9 | private static Player askToSelectPlayer(List<Player> selectedPlayers) {
if (players.isEmpty() || !canExistingPlayersBeSelected(selectedPlayers)) {
return askAddNewPlayer();
} else {
System.out.println("Do you want to: (1) add a new player or (2) select from previously added playe... |
06adb4e0-7af7-4641-a2f0-4cf6c7bc727c | 0 | public Header() {
this.getStyleClass().add("main-tool-bar");
initComponents();
initMovement();
} |
9f115eba-edf5-4320-b507-b883f917965b | 7 | private void KMPSearch() {
// Hitung pinggiran (m, p, b)
int k = 0, q = -1;
b[k] = q;
while (k < m) {
while (q >= 0 && p[k] != p[q]) {
q = b[q];
}
k++;
q++;
b[k] = q;
}
// KMPSearch
int o... |
5d46c01f-c8bd-4b7e-a60e-7a022a3910ea | 2 | public static void main(String[] args) {
if (args.length == 0)
System.out.println(walk("/home/wangwei/Project"));
else
for (String arg : args)
System.out.println(walk(arg));
} |
4515ab23-7397-4e21-875a-4e5d1840c8f2 | 9 | private static void getListFromMysql(List<String> weiboList,List<String> emotionList) {
basecon = new _baseCon();
con = basecon.connSQL();
try {
String getWeiboFenciString = "SELECT * FROM `sentence` WHERE `class` in ('无','无 无') order by`id` limit 0,2000";
PreparedStatement statement = con.prepareStatem... |
4fbdcb92-2c94-499e-b06f-926386c187c6 | 4 | private void fixBounds() {
if (x < xColMin)
x = xColMin;
if (y < yColMin)
y = yColMin;
if (x > xColMax)
x = xColMax;
if (y > yColMax)
y = yColMax;
} |
0cb68f6f-00fc-4f5a-9a33-2869cffac68f | 6 | final private boolean jj_3R_60() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_101()) {
jj_scanpos = xsp;
if (jj_3R_102()) {
jj_scanpos = xsp;
if (jj_3R_103()) {
jj_scanpos = xsp;
if (jj_3R_104()) {
jj_scanpos = xsp;
if (jj_3R_105()) {
jj_scanpos = xsp;
if (jj_3R_106()) re... |
2b235003-c28b-46af-bd95-c853506c9277 | 1 | public String getDescription() {
String description = this.description;
for (Property property : properties.keySet()) {
description += "<br />"+property.toString()+": "+getProperty(property);
}
return description;
} |
13ec4db0-fae4-460d-8674-c001c978ec25 | 1 | public void sendCmd(DatagramPacket dp){
//System.out.println("\nSending...\nPlayer: " + dp.getData()[0] + "\tCMD: " + dp.getData()[1]);
try {
sendSock.send(dp);
} catch (IOException ex) {
Logger.getLogger(Sender.class.getName()).log(Level.SEVERE, null, ex);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.