method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
99a6994b-c392-4b0e-91b7-d703edda5c55 | 4 | public static void pushOtherHosts(String fileName){
File otherHostsFile=new File(fileName);
if(!otherHostsFile.exists())return;
try {
BufferedReader in=new BufferedReader(new FileReader(otherHostsFile));
BufferedWriter out=new BufferedWriter(new FileWriter(new File("hosts"),true));
String temp=in.readLi... |
f49c32fd-fb82-49b6-814c-50e732fcc235 | 1 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
jpcap.NetworkInterface[] devices = JpcapCaptor.getDeviceList();
int index = 0; //My wireless interface's index
JpcapCaptor captor = JpcapCaptor.openDevice(devices[index], 1028, false, 1);
JpcapWriter writer=Jpca... |
c92013ab-a86c-4f5c-bc8a-d1bfaf04e8cd | 2 | public static void main(String[] args) {
int[] array = {1,5,10,8,2,6,7,4,9,3};
Node root = null;
for(int i =0;i<10;i++){
root = treeInsert(root,array[i]);
}
System.out.println("************ Inorder Tree walk ************");
inorderTreeWalk(root);
System.out.println();
System.out.println("************... |
f7b4d04f-a20f-4066-9730-13653ac8fe3c | 9 | protected String step1b2 (String str) {
// AT -> ATE
if (str.endsWith("at") ||
str.endsWith("bl") ||
str.endsWith("iz")) {
return str + "e";
} else if ((endsWithDoubleConsonent(str)) &&
(!(str.endsWith("l") || str.endsWith("s") || str.endsWi... |
c089585d-bdff-4af3-b21c-76d800a4d459 | 6 | public byte[] unZeroCompressDataUsingTable(byte[] compactedByteArray, byte[] zeroCompressionTableByteArray) throws IOException
{
byte uncompactedByteArray[] = new byte[(getByteWidth() * getByteHeight())];
ZeroCompressionTableEntry zeroCompressionTable[] = getZeroCompressionTable(zeroCompressionTableBy... |
1f2e5687-8e97-444c-9c9f-e30adb2ff25a | 3 | protected void fillRaster(int[] pixels, int off, int adjust,
int x, int y, int w, int h) {
switch (fillMethod) {
case FIXED_POINT_IMPL:
// System.out.println("Calling FP");
fixedPointSimplestCaseNonCyclicFillRaster(pixels, off, adjust, x,... |
7af28b3f-37c2-454b-8c0b-22007206e75b | 7 | private void setSequence( URL midiSource )
{
if( sequencer == null )
{
errorMessage( "Unable to update the sequence in method " +
"'setSequence', because variable 'sequencer' " +
"is null" );
return;
}
if( m... |
cc75b581-4661-49c6-a0e5-43dc54fd760e | 9 | public static void main(String[] args) throws Exception
{
String fileName = (args.length > 0) ? args[0] : "c:\\temp\\lena.jpg";
Image image = ImageIO.read(new File(fileName));
if (image.getWidth(null) <= 0)
{
System.out.println("Cannot find file "+fileName);
System.exi... |
a3867b0e-1249-46c4-b742-1ee27ae90a45 | 7 | public int getQuestThingIndex(Iterator<? extends Environmental> i, String name, CMClass.CMObjectType type, int[] num)
{
if(i==null)
return -1;
Environmental E;
for(;i.hasNext();)
{
E=i.next();
if(CMClass.isType(E,type))
{
switch(type)
{
case LOCALE:
if(CMLib.map().getExtendedRoomID... |
12a07a6a-0e0d-48ad-a6f2-e19d1950985b | 4 | public void mouseClicked(MouseEvent me)
{
xpos=me.getX();
ypos=me.getY();
if(xpos>rectlxco && xpos<rectlxco+rectlwidth && ypos>rectlyco&&
ypos<rectlyco+rectlheight) rectlclicked=true;
else
rectlclicked=false;
repaint();
} |
a1eab22a-b2a8-4308-a14d-fa41e4b7132c | 3 | public final void visitInnerClass(final String name,
final String outerName, final String innerName, final int access) {
StringBuffer sb = new StringBuffer();
appendAccess(access | ACCESS_INNER, sb);
AttributesImpl att = new AttributesImpl();
att.addAttribute("", "access", "access", "", sb.toString());
if... |
556d7fdb-0e4a-4839-9c61-d92219c81a26 | 5 | @Override
public MapConnector<String, Integer> forceSynchronization() throws SQLException {
super.addSQLJob(new SQLJob<String, Integer>() {
@Override
public void executeJob(Connection con, Map<String, Integer> map) throws SQLException {
StrIntNonBlockingConnector.this... |
cbb3bc75-541d-4854-94b9-e366e3b036e5 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ID;
result = prime * result + ((nick == null) ? 0 : nick.hashCode());
return result;
} |
a9e822fd-f2c4-4476-8c3c-79ebbe64e1f0 | 9 | public static void walkPhaseOneUnit(TranslationUnit unit) {
{ Object old$Localvariabletypetable$000 = Stella.$LOCALVARIABLETYPETABLE$.get();
Object old$Currenttranslationunit$000 = Stella.$CURRENTTRANSLATIONUNIT$.get();
try {
Native.setSpecial(Stella.$LOCALVARIABLETYPETABLE$, KeyValueList.newKe... |
6f64a168-5fd0-4ff1-bc90-ee956a5568b6 | 7 | void init() {
if (this.events == null) {
events = new EventSetDescriptor[0];
}
if (this.properties == null) {
this.properties = new PropertyDescriptor[0];
}
if (properties != null) {
String defaultPropertyName = (defaultPropertyIndex != -1 ? p... |
cbfa9ac8-2d76-420c-9bdb-4a14f23c81f4 | 1 | public boolean add(Object li) {
if (contains(li))
return false;
grow(1);
locals[count++] = (LocalInfo) li;
return true;
} |
a72c14c2-799a-4d79-a49a-89d730e5b606 | 0 | public boolean getRightKeyPressed() {
return rightKeyPressed;
} |
d4d63fd5-ec52-43f4-a057-0956ebeac697 | 5 | public void sortByValue() {
// Sorts the cards in the vHand so that cards of the same value are
// grouped together. Cards with the same value are sorted by suit.
// Note that aces are considered to have the lowest value, 1.
Vector vNewHand = new Vector();
while (vHand.size() > 0... |
7e022f69-29ad-44ab-9cdf-3b99b242056c | 9 | @Test
public void multiThreadedOperationsTest() throws InterruptedException, ExecutionException {
logger.info("fill the space with entries");
ExecutorService threadPool = Executors.newFixedThreadPool(NUM_OF_THREADS);
List<Future<?>> futures = new ArrayList<Future<?>>();
for (int i = 0; i < NUM_OF_THREADS; i+... |
056c1d2d-4d4c-4b70-8e02-f7d3ca0efb76 | 3 | private static void activateSubmitReminderHTML(Request request, Response response) {
boolean submitResult = false;
Reminder newReminder = new Reminder();
if (parsAndSetNewReminder(newReminder, request)) {
if (DBHandler.addReminder(newReminder)) {
submitResult = true;
}
}
if (submitResult) {
re... |
6942c71a-10f8-44db-b3f3-94de81ba4d90 | 3 | public static void main(String[] args) {
Line line = new Line();
System.out.println("Before saving object:\n" + line);
try (ObjectOutputStream outstream = new ObjectOutputStream(
new FileOutputStream("graph.dat"))) {
outstream.writeObject(line);
} catch (IOException ie) {
System.out.println("Error wri... |
8489cc78-92f5-4c65-b95c-c48e0a2111c1 | 4 | public static void main(String[] args) {
Employee e1 = new Employee("Tom", "Tommerson", "555-55-5555");
Employee e2 = new Employee("Sneaky", "Sneakerson", "444-55-5555");
Employee e3 = new Employee("Sally", "Sallerson", "333-55-5555");
Employee e4 = new Employee("Bill", "Billerson", "444... |
addf9483-d353-4be3-883b-89c9f77b9dbf | 0 | @Override
protected int processSortInfo (byte[] sortInfo)
{
// TBD
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbTMReaderWriter:processSortInfo"); }
return SUCCESS ;
} // end protected method processSortInfo; |
30c66df9-91b9-4c34-b10c-2aedfbcee1ea | 2 | private static Scanner makeScanner(File file) {
FileReader reader;
try { // the file may or may not exist at this point
reader = new FileReader(file);
} catch (FileNotFoundException fnf_exception) {
// WE WILL PROBABLY WANT TO INTEGRATE THIS INTO THE GUI
// Print the name of the missing file:
localErr... |
6a5ac552-7fe0-47f3-9f27-3ec77ceec82a | 1 | public void setDownSafe(final boolean flag) {
downSafe = flag;
if (SSAPRE.DEBUG) {
System.out.println(this);
}
} |
9bed04aa-5f30-459e-89d2-db9b9b402732 | 6 | public void readLexicon(ID wid,
ID tid,
HashMap<Integer, ArrayList<Integer>> pTags,
HashMap<Integer, ArrayList<Integer>> pWords) {
String line;
BufferedReader br = null;
try {
br = new BufferedReader... |
3e57447e-3af7-41bd-9008-849f2e50fa21 | 0 | public boolean isMaximized() {
return Preferences.getPreferenceBoolean(Preferences.IS_MAXIMIZED).cur;
} |
ecb0dabb-0d62-4854-b354-e9ee907dbca6 | 9 | public static int Compare(MessageNumber a, MessageNumber b)
{
int result = 0;
if (a!=b)
{
if (((Object)a == null) && ((Object)b != null))
{
result = -1;
}
else if (((Object)a != null) && ((Object)b == null))
{
... |
3f54d0c0-6f8c-4ce9-b835-3ac7db541101 | 2 | public void set(int key, int value) {
timeStamp++;
if ( cache.containsKey(new Key(key, 0)) ) {
cache.put(new Key(key, timeStamp), value);
} else {
if ( cache.size() >= capacity ) {
cache.pollFirstEntry();
}
cache.put(new Key(key, ti... |
9e366cd9-d1a8-4b54-910a-b202166e89e9 | 4 | public TreeNode recBuildTree(int[] preorder, int pb, int pe, int[] inorder, int ib, int ie){
if(pb>pe) return null;
TreeNode root = new TreeNode(preorder[pb]);
if(pb == pe) return root;
int idx = 0;
for(int i = ib; i<= ie; i++){
if(inorder[i] == preorder[pb]){
idx = i-1;
break;
}
}
Tre... |
50d07e26-a285-444d-9f7d-3220123d5a82 | 4 | public File encode(Serializable structure, File file, Map parameters) {
Transducer transducer = null;
try {
transducer = TransducerFactory.getTransducer(structure);
/*
* If we are saving a pumping lemma, the associated structure would
* actually be a pumping lem... |
169001c0-cc5b-4839-87eb-1fc12fc95eb0 | 4 | public void render(Graphics g){
g.setColor(Color.WHITE);
g.setFont(JudokaComponent.bigFont);
for (int i = 0; i < items.length; i++) {
if(i == selectedItem && items[i] != null)
g.drawString("> " + items[i] + " <" , JudokaComponent.WIDTH / 2 - (items[i].length() + 4) * 10 + 200, 50 + JudokaComponent.HEIGHT /... |
a7f15d1e-831c-41d7-a807-a9d5cc96ba6c | 6 | public int getRandomRadix() {
int rand = (int) (Math.random() * 5); // 0-4
int result = -1;
switch(rand) {
case -1:
result = 2;
break;
case 0:
result = 2;
break;
case 1:
result = 8;
break;
case 2:
result = 10;
break;
case 3:
result = 16;
break;
case 4://to get a mas... |
d11fd096-9fc8-4202-b082-656b2cd0e68a | 1 | private static String lireFichier(String nomFichier) throws IOException
{
String contenu = null;
File fichier = new File(nomFichier);
if(!fichier.exists())
return null;
FileReader reader = new FileReader(fichier);
char[] chars = new char[(int) fichier.length()];
reader.read(chars);
... |
61b00520-900a-4340-8518-a96b2c1ba12c | 4 | public String getReverse(){
String foo = "";
for (int i = _board.length-1;i>-1;i--){
for (int u = _board[0].length-1;u>-1;u--) {
if (_board[i][u] == null){
foo += "_____" + "\t\b";
continue;
}
foo += " " + _board[i][u] + "\t\b";
}
foo += "\n";
for (int u = _board[0].length-1;u>-1;u... |
50a4a5cb-1776-4729-8661-cadcdbf4b155 | 7 | public Window(String name) {
ar = new int[3][3];
initComponents();
gridPanel.setOpaque(false);
scoreBoard.setOpaque(false);
startBtn.setOpaque(false);
startBtn.setContentAreaFilled(false);
b00.setOpaque(false);
b00.setContentAreaFilled(false);
b0... |
4e5dc53c-0e83-4c1f-b3ce-7f7ca1268eb8 | 5 | public static Image createImageFromBitmap(
byte[] bytes,
int width,
int height) {
Display.check();
int pix[] = new int[width * height];
int index = 0;
int srcPos = 0;
int dstPos = 0;
int bgcolor = ApplicationManager.manager.bgColor.getRGB();
for (int y = 0; y < height; y++) {
int mask = 128;... |
8eceeeba-0f80-4488-bf55-915e15db1f5a | 8 | public static String getTypeName(int arrayType) {
switch (arrayType) {
case _newarray.TYPE_BOOLEAN:
return "boolean";
case _newarray.TYPE_BYTE:
return "byte";
case _newarray.TYPE_CHAR:
return "char";
case _newarray.TYPE_DOUBLE:
return "double";
case _newarray.TYPE_FLOAT:
return "float";
cas... |
79264f3e-6dc6-4c4d-8645-8fbb01835a9d | 3 | public Rates(HttpResponse response, BitPay bp) {
BufferedReader rd;
try {
rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuilder content = new StringBuilder();
String line;
while (null != (line = rd.readLine())) {
content.append(line);
}
Obj... |
a6ee5766-d77a-4774-bc69-030a1f816ec5 | 9 | final public String condition() throws ParseException {
/*@bgen(jjtree) COND */
SimpleNode jjtn000 = new SimpleNode(JJTCOND);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t; String s; String cond = "";
try {
cond = operand();
t = jj_consume_token(COMPARE);
cond += ... |
130d27e8-49da-4c18-a450-6721a080d3b0 | 4 | private static void Countsplit(int i, int n) {
// TODO Auto-generated method stub
int[] arraya = Arrays.copyOfRange(array, i, n/2);
int[] arrayb = Arrays.copyOfRange(array, (n/2) +1, n);
int ll = 0;
int j=0;
int k=0;
for(ll=i;ll<n;ll++){
if(arraya[j]<arrayb[k]){
array[ll] = arraya[j];
... |
85833dcf-3dfd-4b1a-b4ee-8629bd0e6ae5 | 2 | public int readMemory(int address){
if(address>=0&&address<65536)
return memnc[address];
else
return -1;
} |
07af2156-77c5-4832-9217-5efbe587d6c3 | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize ... |
26172391-4c64-44a0-bb8f-c3195b03f94d | 5 | @SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj)
{
if (obj instanceof Tuple<?,?>) {
if(x.equals(((Tuple<X,Y>)obj).x) && y.equals(((Tuple<X,Y>)obj).y))
{
return true;
}
}
return false;
} |
d137ad82-10ba-4db2-a54b-12d81aec92f4 | 4 | public static List<UserInfo> getEventMemebers(int eventId)
throws HibernateException {
List<UserInfo> eventUserList = null;
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
try {
// Begin unit of work
session.beginTransaction();
// get the event users
String hql = "select e... |
bd967a51-b75a-4588-9353-dfeb9ccc34cd | 5 | public void mousePressed(MouseEvent e) {
// check every menu item in the current array to see if the click was within its bounds
int mx = e.getX();
int my = e.getY();
for(int i = 0; i < cong.menu.mi.length; i++){
if(mx >= cong.menu.mi[i].getX() && mx <= cong.menu.mi[... |
e560db3a-115f-4aad-aaa4-f26e6957e388 | 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... |
fc2b4c80-579b-435e-8fc6-d7c93706393a | 2 | public void setValidating(boolean validate) throws SAXException, MalformedURLException, ParserConfigurationException {
// Create the validator on demand (it takes a while and requires connectivity)
if (validate && (xliffValidator == null)) {
this.xliffValidator = new XliffValidator();
... |
db9c6e4a-a6c0-4d1b-bede-fe161e1c2b33 | 2 | @Override
public String ask(Tweet question, Abo abo) {
String asking = question.getText().toUpperCase();
if(asking.contains("OWNER")){
if( abo.getEleveur() != null)
{
String answer = "My owner is @" + abo.getEleveur() + ".";
... |
711b9708-82da-4463-b4aa-c844668cb6e6 | 5 | public void setFee(double amount) {
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("UPDATE " + Constants.SQLTable + "_Banks SET fee = ? WHERE id = ?");
ps.setDouble(1, amount);
ps.setInt(2, t... |
bbca86d5-d9c6-4414-86b2-2fa312388a06 | 5 | public void saveQuest(File file, Quest q) throws IOException
{
TagCompound tag = new TagCompound();
tag.setTag("name", new TagString("name", q.getName()));
Stage fs = q.getFirstStage();
TagCompound fstage = saveStage(fs);
fstage.setName("firststage");
fstage.setTag("id", new TagString("id", fs.getID()));
... |
948be160-9a31-486a-8383-199eb6d1222c | 5 | private void createEnemyPanel() {
effectPText.setText(null);
//Enemy
panelEnemy = new JPanel();
panelEnemy.setLayout(new BoxLayout(panelEnemy, BoxLayout.Y_AXIS));
raceTextEnemy = new JTextField("");
healthTextEnemy = new JTextField("Health: " + Integer.toString(enemy.... |
19d91a02-9fbb-431c-bbcb-be3bd346e54e | 8 | @Override
public void spawnChild() throws Exception {
Stack<Position> neighbor = this.field.getNeighborPositions(this.pos);
while(!neighbor.empty()) {
Position n = neighbor.pop();
Creature content = n.getContent();
if(content != null && content instanceof Tiger) {
return;
}
}
Stack<Position>... |
6ba97b10-da2e-4f64-bae0-d4deaa141c34 | 9 | public static String getStorageStatusCaption(byte status) {
switch (status) {
case FDFS_STORAGE_STATUS_INIT:
return "INIT";
case FDFS_STORAGE_STATUS_WAIT_SYNC:
return "WAIT_SYNC";
case FDFS_STORAGE_STATUS_SYNCING:
return "SYNCING";
case FDFS_ST... |
d3df8380-436e-44d4-b417-46e24eb322cd | 0 | public TravelTrip findById(int id){
return travelTripDao.findById(id);
} |
265a4326-0f93-41f4-8922-28ab70c71ac3 | 3 | public void setNao(TNao node)
{
if(this._nao_ != null)
{
this._nao_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
96fa5a76-cc24-404b-b58d-6e5303ede476 | 2 | public boolean setFornecedor(String razao, String nomeOUCodigo){
Produto p = getProduto(nomeOUCodigo);
if(p!= null && razao != null){
p.setFornecedor(razao);
return true;
}
return false;
} |
b0f88841-8750-403c-a781-402ec541c6a0 | 5 | @Override
public boolean canInsert() {
if (username == null) {
return false;
}
if (firstName == null) {
return false;
}
if (lastName == null) {
return false;
}
if (password == null) {
return false;
}
... |
a3d7a9b6-ae17-432a-a1e8-7ec64557b0bb | 9 | public static void main(String[] args) {
int op=0;
do{
System.out.println("1- Configurar Archivo");
System.out.println("2- Crear Archivo");
System.out.println("3- File Info.");
System.out.println("4- Borrar");
System.out.println("5- Cr... |
419a1d52-ccd1-48bb-8b2f-d38a48f6efd6 | 0 | @Override
public int hashCode() {
int result = new String(this.address + ":" + this.port).hashCode();
return result;
} |
6b5ee0fd-ad81-4c61-a998-6a0e1504349e | 1 | private boolean jj_2_27(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_27(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(26, xla); }
} |
312295d4-a8c2-4344-921a-718f00cd9ac7 | 8 | public Class getColumnClass(int columnIndex) {
if (columns != null) {
// if editor class is specified, using that...
Class editorClass = columns[columnIndex].getEditorClass();
if (editorClass != null) {
return editorClass;
}... |
e6dee0fe-96dc-4094-9b10-820e7d00f4af | 2 | @Override
public void calculate(double[][] heightmap, boolean[][] watermap) {
calc = new double[heightmap.length][heightmap.length];
for (int x = 0; x < heightmap.length; x++)
for (int y = 0; y < heightmap[x].length; y++)
moisture(heightmap, watermap, x, y);
} |
3b9fb3a0-bafa-45b2-a868-3bf5e77e064e | 3 | public CSVImporterDialog(Dictionary dictionary) {
dic = dictionary;
importer = new CSVImporter();
ChangeListener resetOk = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
okButton.setEnabled(false);
}
};
setBounds(100, 100, 699, 421);
getContentPane().setLayout(new Border... |
00ed6a46-8512-4b7f-82ef-5d26fdcac489 | 8 | public ConstantArrayOperator(Type type, int size) {
super(type);
argType = (type instanceof ArrayType) ? Type
.tSubType(((ArrayType) type).getElementType()) : Type.tError;
Object emptyVal;
if (argType == type.tError || argType.isOfType(Type.tUObject))
emptyVal = null;
else if (argType.isOfType(Type.tB... |
e694ca57-f1ba-4e7c-9cbe-aeea88a39af3 | 6 | public int evaluatePiecePositions() {
int score = 0;
for ( int rank = 0; rank < 8; rank++ ) {
for ( int file = rank * 16 + 7; file >= rank * 16; file-- ) {
if ( !squareEmpty( file ) && pieceColourAt( file ) == this.turnColour ) {
if ( isWhiteTurn() ) {
score += piecePosition... |
1efe9bc2-a05f-4afe-819a-5d1b7af69ee8 | 2 | * @param selected Whether the row should be considered "selected".
* @param active Whether the outline should be considered "active".
* @return The background color for the specified row index.
*/
public Color getBackground(int rowIndex, boolean selected, boolean active) {
if (selected) {
return getListBack... |
b5a6ae6e-5654-4c74-a65e-893828843a2d | 7 | protected void appendInterfaces(final Class<?>[] interfaces) {
if(null != interfaces && interfaces.length > 0) {
if(null == this.interfaces) {
this.interfaces = new ArrayList<Class<?>>();
}
for(Class clazz : interfaces) {
if(!this.interfaces.c... |
149e0baf-9301-4df6-9ea9-a38c214ae3da | 5 | public void setPause(boolean pause) {
if (ogg != null) {
if (pause) {
ogg.pause();
} else {
ogg.resume();
}
}
if (clip != null) {
// Catch any errors.
try {
// Can we mute?
if (clip.isControlSupported(BooleanControl.Type.MUTE)) {
// Get the control.
BooleanC... |
89d4773e-6b42-44e5-a0b7-3a9838d37019 | 0 | public List<Root> getNode() {
return branchs;
} |
06c70f4b-547f-45ca-8b46-22f30345c419 | 3 | private double[] calculateNetworkConsumptionW(Message message, SoftwareSystem system) {
double consumption[] = { 0, 0 };
for (Connector connector : project.getConnectors())
if (connector.getComponent().equals(message.getSender()) && connector.getToInterface().equals(message.getSignature())) {
consumption = U... |
1959b269-5d16-4c34-89a9-809d8a38fdf2 | 5 | protected Behaviour getNextStep() {
if (nursery.type != Plantation.TYPE_NURSERY) return null ;
//
// If the nursery has adequate stocks, just return.
if (nursery.stocks.amountOf(cropType) > 1) return null ;
final BotanicalStation station = nursery.belongs ;
//
// If the nursery has enough ... |
c2c6a3dc-4849-4045-a9eb-c0535c2ddd33 | 4 | private boolean seekEOL() {
// Set maximum and current bit index into the compressed data.
int bitIndexMax = data.length * 8 - 1;
int bitIndex = bytePointer * 8 + bitPointer;
// Loop while at least 12 bits are available.
while (bitIndex <= bitIndexMax - 12) {
// Get the next 12 bits.
int next12Bits = n... |
c7b41c8d-4529-444b-9a12-66baba04a4c7 | 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... |
459b21ba-d336-46d7-aba4-5a53df30f11c | 4 | public void checkCbolOriginalDirV4() {
Path dir = Paths.get(CBOL_HOME);
// List<String> books = new ArrayList<>();
Set<String> books = new HashSet<>();
StringBuilder sb;
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
for (Path file : stream) {
... |
4ecfd4ce-7872-441a-95eb-e36c0b275fb2 | 6 | protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = 1);
... |
0469b7c3-bf23-45f3-aacb-e68edfecb271 | 0 | public LinkedHandlerBuilder ifMatches( Filter filter )
{
return this.wrapped.ifMatches( filter );
} |
6770469d-ca59-45e6-953c-bb9418c01c62 | 6 | * @return Vector
*/
public static Vector coerceToVector(Stella_Object self) {
{ Vector vector = null;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_VECTOR)) {
{ Vector self000 = ((Vector)(self));
ve... |
2f6626a1-4417-40a4-bd61-68d5b26fb2c5 | 0 | private OpenFileHelper() {
} |
d111b0b1-7c23-425b-9dd2-ed8b99cd290d | 2 | private void extractAssemblercode() {
for(int i = 0; i < sourceLine.size(); i++) {
if(!(sourceLine.get(i).charAt(0) == ' ')) {
String dst = sourceLine.get(i).substring(5, 9);
// System.out.println(dst);
Integer befehl = (int) Integer.parseInt(dst, 16);
// System.out.println(befehl);
asmProg.... |
5808ba64-71d2-4673-8519-fd9e782bdf8d | 3 | public void run(){
try{
DataInputStream is = new DataInputStream(socket.getInputStream());
DataOutputStream os = new DataOutputStream(socket.getOutputStream());
while(true){
System.out.println("Accpet.");
String receiveMessage = is.readUTF();
System.out.println("Receive from client: " + receiveMe... |
75dbbc5e-8bef-456f-ad56-39702e5ece17 | 9 | public static String[] genParamNames(String srgId, String[] paramTypes, boolean isStatic)
{
boolean skip2 = (paramTypes.length >= 4) && paramTypes[0].equals("Ljava/lang/String;") && paramTypes[1].equals('I')
&& paramTypes[0].equals(paramTypes[2]) && paramTypes[1].equals(paramTypes[3]);
... |
ed113124-b0d4-4789-a543-2c5a6dce7e72 | 2 | public static void printMap(Map map,String prefix){
for(Map.Entry entry : (Set<Map.Entry>)map.entrySet()){
if(entry.getValue() instanceof Map){
System.out.println(prefix+"map:"+entry.getKey());
printMap((Map)entry.getValue(),prefix+"--");
}else{
... |
e4e554d8-1138-4704-a66d-e6445f3db48f | 1 | public void enter(MinersSon son){
//if the miner is not already located at the goldmine, he must
//change location to the gold mine
if (son.getLocation() != Location.backyard)
{
System.out.println(son.getName() + " LET'S PLAY SOME BALL!");
son.changeLocation(Location.backyard);
}
} |
b353540d-124d-4740-8a36-9563a0744662 | 0 | public VDGTransition(State from, State to) {
super(from, to);
} |
227c8e5c-b065-4cdb-a72c-1982df6aa997 | 1 | private void sendComboBox (String name)
{
String temp = ("INVITE@" + name + "@" + roomId);
temp += ( "@" + usernames.size() );
for ( int j = usernames.size() - 1; j >= 0; j-- )
{
temp += ( "@" + usernames.get(j) );
}
client.sendMessage(temp);
} |
27c7eaa7-fd17-4cff-bdc9-1a99d3bf9330 | 8 | private void increaseScore(int a) {
if (level >= 5 && level <= 7) {
a *= 2;
} else if (level <= 10) {
a *= 3;
} else if (level == 11) {
a *= 4;
} else if (level == 12) {
a *= 5;
} else if (level == 13) {
a *= 10;
... |
5d836363-43e0-4c43-a287-411ba7670033 | 3 | public double[][][] getGridDydx3(){
double[][][] ret = new double[this.lPoints][this.mPoints][this.nPoints];
for(int i=0; i<this.lPoints; i++){
for(int j=0; j<this.mPoints; j++){
for(int k=0; k<this.nPoints; k++){
ret[this.x1indices[i]]... |
143bbb36-1297-420b-9e16-96e1c46d0878 | 3 | private static void setValue(PreparedStatement ps, int paramIndex, Object inValue) throws SQLException {
if (ClassHelper.isTypeString(inValue.getClass())) {
ps.setString(paramIndex, inValue.toString());
} else if (ClassHelper.isTypeDate(inValue.getClass())) {
ps.setTimestamp(paramIndex, new Timestamp(((java.u... |
70b18f2c-e20d-4fcc-b40f-8cf56d9197fb | 8 | static boolean esSlimp(char[] str, int cotaInf, int cotaSup){
if(cotaInf >= cotaSup)return false;
if(str[cotaInf] != 'A')return false;
if(cotaSup == cotaInf + 1 && str[cotaSup] == 'H')return true;
if(cotaSup <= cotaInf + 1)return false;
if(str[cotaInf+1] == 'B' && str[cotaSup]=='C')return esSlimp(str, cotaInf... |
8c7dd5fa-d85a-4ce7-980a-470b064a58e9 | 1 | private void refresh(IEmailKontakt contact) {
ek = contact;
if (ek == null) {
textField.setText("");
textField_1.setText("");
textField_2.setText("");
textField_3.setText("");
ek = ekd.create();
} else {
textField.setText(ek.getVorname());
textField_1.setText(ek.getNachname());
textField_2... |
ef92086f-deb5-4191-bca3-278666b97852 | 2 | @Override
public Connection open() {
if (initialize()) {
String url = "";
try {
url = "jdbc:mysql://" + this.hostname + ":" + this.portnmbr + "/" + this.database;
//return DriverManager.getConnection(url, this.username, this.password);
this.connection = DriverManager.getConnection(url, this.user... |
eed00bc4-8eda-4baf-b632-ad18aa95e5d3 | 8 | public static String fixName(String s)
{
if(s.length() > 0)
{
char ac[] = s.toCharArray();
for(int j = 0; j < ac.length; j++)
if(ac[j] == '_')
{
ac[j] = ' ';
if(j + 1 < ac.length && ac[j + 1] >= 'a' && ac[j + 1] <= 'z')
ac[j + 1] = (char)((ac[j + 1] + 65) - 97);
}
if(ac[0] >= ... |
7ccd7031-9568-4da8-9e3b-ae5e1a0a8ae1 | 8 | static LinkedList<Part> sort1(LinkedList<Part> unsorted)
{
if (unsorted.size() <= 1)
return unsorted;
int mid = unsorted.size()/2;
int size = unsorted.size();
LinkedList<Part> sorted = new LinkedList<Part>();
LinkedList<Part> first = new LinkedList<Part>();
LinkedList<Part> second = new LinkedList<Part>... |
e4d45076-ab6d-4a09-be2b-de83e855c52d | 0 | public CarItf makeCar() {
// Construct the AutoBean
AutoBean<CarItf> car = factory.car1 ();
// Return the Book interface shim
return car.as();
} |
a3d2bc3e-fa03-4f8c-aac3-d94053a65989 | 6 | public static Cons yieldLocalInitialValueAssignments(Stella_Class renamed_Class) {
{ Cons assignments = Stella.NIL;
Stella_Object initialvalueassignment = null;
{ Slot slot = null;
Cons iter000 = renamed_Class.classLocalSlots.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter0... |
284a35aa-0288-4948-836e-f94339e7e09b | 7 | @Override
public void mouseClicked(MouseEvent e)
{
if (toolBar.isAddingLink() || toolBar.isEditingLink()
|| toolBar.isRemovingLink())
{
int x, y;
x = ((e.getX() - (lblMap.getWidth() - 32 * map.getWidth()) / 2) / 32);
y = ((e.getY() - (lblMap.getHeight() - 32 * map.getWidth()) / 2) / 32);
if (map.g... |
a8e208db-f388-44c1-97f9-a34740e95aa2 | 6 | private static void showAvgGroupSummaries() {
StringBuilder out = new StringBuilder();
out.append("\n==============================================\n");
out.append("===== Avg System Time per/context group =====\n");
out.append("==============================================\n");
... |
0efd2bf6-16bd-4ce0-a845-6c5385886d15 | 5 | private void render(Graphics2D g){
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
this.setBackground(Color.black);
Rectangle r = this.getBounds();
int lastText = (int) (r.getHeight() - margin);
if (scale != 0.0F) {
float size = 0.0F;
Tool lastTool = null;
for ... |
9665e900-b37a-4f0b-9ff5-94709ec74cb3 | 2 | private SkipButton() {
super(Text.BTN_UNKNOWN_CUE);
text = Text.BTN_UNKNOWN_CUE;
this.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) {
disableKeyListener();
if (text == Text.BTN_UNKNOWN_CUE) {
Experiment.xp.skipFurtherAssociations("__UNKNOWN__");
} ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.