method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
10a478ed-f352-4e01-ac7f-039dfd9d8665 | 2 | int emptyBuckets() {
int n = 0;
for (int i = 0; i < buckets(); i++) {
if (!filter_.get(i)) {
n++;
}
}
return n;
} |
70c0d33a-0e96-4aa3-95ab-a2b952f4a24c | 0 | public static void exit(){
DebugUtils.info("Closing application");
moduleManager.unloadAllModules();
desktop.getFrame().dispose();
} |
52a63484-db73-4cac-90f3-12a01971a31c | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, IsActive__typeInfo)) {
... |
876a567b-9808-4377-9c6b-226bcb21db7f | 8 | public double interpolate(double[] unknownCoord){
int nUnknown = unknownCoord.length;
if(nUnknown!=this.nDimensions)throw new IllegalArgumentException("Number of unknown value coordinates, " + nUnknown + ", does not equal the number of tabulated data dimensions, " + this.nDimensions);
sw... |
70b5d457-023a-422a-8890-a9e01f3f8bcb | 3 | public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int numOfCases = sc.nextInt();
for(int i = 0; i < numOfCases;i++)
{
//Gets how long the test key is
int tesetLength = sc.nextInt();
//Need to jump to next line to get the data
sc.nextLine();
String testAnswers = sc.ne... |
bbb0c4e0-2697-4a61-a72c-980b4433b636 | 5 | public static void main(String[] args) throws IOException {
// Text file, where
// First line contains int dimension value
// Second line contains monoms' power values
// Third line contains coefficients, startin' with major monom coefficient
String filePath = "c:\\NumMath\\EQ3.... |
4c5ff665-75ad-46f0-b7f0-b0e10858d958 | 1 | private void setOutput(Quote quote) {
String[] lines = quote.getContent();
for ( String line : lines )
reaction.add( Formatter.removeHTML(line) );
String url = "-- http://bash.org/?" + quote.getTextId() + " -- Next bash in " + getNextBashTime();
reaction.add(url);
} |
85ad5998-d544-487f-8906-64e887ca397d | 7 | public ArrayList generateTokens(String docContents, String tokenizationType) {
ArrayList<String> tokens = new ArrayList<>();
if (tokenizationType.equals("1-Grams")) {
tokens = generateOneGrams(docContents);
} else if (tokenizationType.equals("Bi-Grams")) {
token... |
0a36e7a3-f71f-45dd-9ca0-f447cbf32c95 | 8 | public void actionPerformed(ActionEvent e) {
if(e.getSource() == frame.btnGetModels){
txtArea.append(" " + "\r\n");
txtArea.append("----- Getting native models ------------------" + "\r\n");
List<Uuid> objUUIDs = getAllUUIDs();
ArrayOfUUID arrayUUIDs = new ArrayOfUUID();
List<Uuid> listUUIDs = arr... |
abb8b246-d2a5-4eab-a4c3-44dc87446e1d | 1 | public String getNotes()
{
if(this.contactNotes==null)
{
return "";
}else{
return contactNotes;
}
} |
6ebc7b50-88f7-4632-8406-ef9e3dab9590 | 9 | public static Point2D coordinates(final Rectangle2D rectangle,
final RectangleAnchor anchor) {
Point2D result = new Point2D.Double();
if (anchor == RectangleAnchor.CENTER) {
result.setLocation(rectangle.getCenterX(), rectangle.getCenterY());
}
... |
0d3a17b1-87d4-417a-8355-0ded7d00401c | 5 | public TranscriptSet(Genome genome) {
transcripts = new HashSet<Transcript>();
transcriptsByChromo = new AutoHashMap<String, ArrayList<Transcript>>(new ArrayList<Transcript>());
for (Gene gene : genome.getGenes()) {
if (gene.numChilds() > MAX_TRANSCRIPTS_PER_GENE) {
System.err.println("Ignoring gene '" + ... |
00abf887-bcc6-4a21-ad75-1b199d9378e7 | 4 | private void addChosenPlattform() {
lblPlattformError.setVisible(false);
DefaultListModel<Plattform> dlm = (DefaultListModel<Plattform>) listChosenPlattformar.getModel();
Plattform chosen = (Plattform) cbPlattformar.getSelectedItem();
boolean exists = false; // search if the same plattfo... |
bb061dc5-12fc-4380-abb2-b0832f6bb72e | 2 | @Override
public void onReceive(int clientId, String message) {
System.out.println("Received message from client " + clientId + ": \"" + message + "\"");
Message msg = Message.parse(message);
switch(msg.getType()) {
case ID_REQUEST:
//TODO send id response, send spawn messages to client, send spawn messag... |
6999d013-1ef0-4174-a005-8b4c11f920ef | 2 | public void doAction(){
//*** have to check if it is sorted ************************************************************
String[] oldShopList = GasDecisionProcess.getShopListCopy();
GasDecisionProcess.resetShopList(); //Set the ShopList to null
if (userChoice == 1) {
DPH... |
ebdb6daf-d2c8-4ce0-91e7-7695418d8e9f | 7 | public void valueChanged(ListSelectionEvent lse) {
JList list = (JList) lse.getSource();
if (list == allAccounts) {
if (!lse.getValueIsAdjusting() && allAccounts.getSelectedIndex() != -1 && project != null) {
moveTo.setEnabled(true);
} else {
moveTo.setEnabled(false);
}
} else if (list == project... |
885107df-1ff5-42b6-8932-8cb873677d49 | 6 | public void load()
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new org.xml.sax.ErrorHandler() {
public void fatalError(SAXParseException e) thr... |
1cdf0ddd-2640-45e1-8a6d-6b91957dec76 | 9 | public static QuestionPower decode(String str) throws DecodeException {
QuestionPower res;
if (str.substring(0,14).compareTo("#QuestionPower") == 0) {
res = new QuestionPower();
int i = 14;
if (str.charAt(i) == '<') {
while (str.charAt(i) != '>') {
... |
3ed5a0d9-00d2-4103-b382-d6857e6cb424 | 5 | @Override
public String execute() throws Exception {
try {
Random rand = new Random();
setConfcode(rand.nextInt());
if (pwd.equals(getConfirmpwd())) {
TempUser tuser = new TempUser(getConfcode(), email, pwd, userEnum.NotRegistered.getUserType(), uname... |
a83ee241-b454-4693-a0e8-520ba0d10288 | 7 | public static void load() {
try {
File f = new File("./Data/data/map_index");
byte[] buffer = new byte[(int) f.length()];
DataInputStream dis = new DataInputStream(new FileInputStream(f));
dis.readFully(buffer);
dis.close();
ByteStream in = new ByteStream(buffer);
int size = in.length() /... |
b91f562f-eb42-4fa7-8d42-fb47202b522f | 4 | private void maybeAddPassword(final CycFort cyclist, final CycDenotationalTerm applicationTerm,
final StringBuilder stringBuilder) {
if (cyclist instanceof CycConstant) {
final PasswordManager passwordManager = new PasswordManager(this);
try {
if (passwordManager.isPasswordRequired()) ... |
e3d488bb-5eee-4736-bdf3-5dfae27f52a8 | 6 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name);
if (options.size() == 0) {
sb.append("\t").append(description);
} else {
int maxLen = 0;
for (CommandOption option : options) {
if (!"".equals(option.getName()) && option.getName().length() > maxLen) maxLen = option... |
a26def21-ebc1-45bd-bdd5-5cd88d0ee688 | 0 | public void setCurrentPoint(int current){
currentPoint.setText(Integer.toString(current));
} |
e6a62bff-b15c-45f5-b1f6-6107585c32d8 | 4 | public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
Player player = (Player) sender;
int X = player.getLocation().getBlockX();
int Y = player.getLocation().getBlockY();;
int Z = player.getLocation().getBlockZ();;
if(args.length >= 1){
//EASYレベル
if(arg... |
e0222f9f-c46d-4261-9eef-5d5dd83a58c2 | 1 | public void setPos2(int val){ if (val == 1){p2 = true;} else { p2 = false; }} |
c3b327d0-92a3-49a8-9933-ac1ca0896e4a | 2 | @EventHandler (priority = EventPriority.HIGH)
public void onUpdateJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
// They must have this permission to receieve any notification.
if(!p.hasPermission("playerchat.mod")) return;
if(!PlayerChat.update) return;
Messenger.tell(p, PlayerChat.name + " is a... |
f6c81c8e-0c8b-450d-8183-a203161c23db | 0 | public final void sendNotice(String target, String notice) {
_outQueue.add("NOTICE " + target + " :" + notice);
} |
6bc1e434-cb6e-43e2-8423-836c881f3201 | 0 | public void driver() {
System.out.println("benz drive");
} |
d8bcb3a3-3786-427e-aa38-d08994e2f00c | 9 | private void finishText() {
if (currentText != null) {
String strValue = currentText.toString();
if (currentTextObject != null) {
if (DefaultXmlNames.ELEMENT_Unicode.equals(insideElement)) {
currentTextObject.setText(strValue);
}
else if (DefaultXmlNames.ELEMENT_PlainText.equals(insideElem... |
cac29bb0-e649-483b-939c-635d7cb24803 | 6 | public void jvnLockRead() throws JvnException {
boolean ask = false;
synchronized(this){
System.out.println("lock read Etat courant :"+STATE+" sur l'objet "+joi+" "+System.currentTimeMillis());
if(STATE != STATE_ENUM.RC && STATE != STATE_ENUM.WC){
ask = true;
}
}
if(ask){
obj = JvnServerImp... |
7766fd88-c120-4d05-9f81-097c82f888dc | 2 | @Override
public Color getPixel() {
int random = r.nextInt(3);
if (random == 0) {
return new Color(r.nextInt(256), 0, 0);
} else if (random == 1) {
return new Color(0, r.nextInt(256), 0);
} else {
return new Color(0, 0, r.nextInt(256));
}
} |
c40d0c61-e4b2-4881-9b40-731efa55dd73 | 3 | public void loadRocketSprites(){
rocketSprites = new ArrayList();
ArrayList anims = new ArrayList();
for(int i = 0; i < rocketImages.size(); i++){
Animation a = new Animation();
for(int j = 0; j < rocketImages.get(i).size(); j++){
a.addFrame((Image) rocketImages.get(i).get(j), 200);
... |
4ae23ca9-6afc-4ddb-9a35-a27c25fdd60f | 7 | private void updateAllRQ() {
int c = movie.getCapacity();
for (int i = 0; i < numberOfAtoms; i++) {
try {
atom[i].updateRQ();
} catch (Exception e) {
atom[i].initializeRQ(c);
atom[i].updateRQ();
}
}
if (obstacles != null && !obstacles.isEmpty()) {
RectangularObstacle obs = null;
synch... |
c85454b6-7785-4906-8d3e-395d4ff141fd | 9 | public void init() throws IOException {
ServerSocketChannel channel = ServerSocketChannel.open();
channel.bind(new InetSocketAddress(host, port));
channel.configureBlocking(false);
System.out.println("Server Launched!");
//Creates a selector that will be used for multiplexing
//Registers the Server... |
c1af942c-39c1-42d0-bcd3-ae16ddfb15e6 | 6 | * @param arguments
* @return boolean
*/
public static boolean applyBooleanMethod(java.lang.reflect.Method code, Cons arguments) {
switch (arguments.length()) {
case 0:
throw ((StellaException)(StellaException.newStellaException("Can't call method code on 0 arguments.").fillInStackTrace()));
... |
4f7626e1-d120-4d17-ae95-31e41676853c | 2 | public static void trackAdd(String tag) {
if(trackedTags.containsKey(tag) && trackedTags.get(tag)) {
System.out.println("[Debugger] Tag " + tag + " is being tracked already.");
} else {
trackedTags.put(tag, true);
System.out.println("[Debugger] Now tracking " + tag);
}
} |
fff3761c-4544-4803-827c-1d8375ceab0a | 2 | protected void saveNBT(NBTTagCompound data) {
NBTTagList list = new NBTTagList();
for (WorldCoordinate c : pairings) {
NBTTagCompound tag = new NBTTagCompound();
tag.setIntArray("coords", new int[]{c.dimension, c.x, c.y, c.z});
list.appendTag(tag);
}
d... |
2e8e442c-36f7-4104-acf6-f7feaaee6c00 | 7 | public void drawPlane() {
if(!init) {
init = true;
centerX = getWidth() / 2;
centerY = getHeight() / 2;
}
int width = getWidth();
int height = getHeight();
for(int i = centerX % pixelUnit; i < width; i += pixelUn... |
a77ef56e-99ef-46ca-b901-6f85ebc48986 | 8 | public void equip(Equipment newItem)
{
if(newItem.getPosition() == Equipment.Position.OffHand)
{
Equipment mainHand = getEquipment(Equipment.Position.MainHand);
if(mainHand != null && mainHand instanceof Weapon && ((Weapon)mainHand).isTwoHanded())
_equipment.r... |
cd42a930-30c5-4a1b-859f-64e4cb6e3b54 | 3 | public void search(String name) {
DefaultMutableTreeNode root = (DefaultMutableTreeNode)
treeThreats.getModel().getRoot();
Enumeration<?> children = root.children();
while (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode)
children.nextElement();
if (child.getUse... |
67181b49-662f-4375-b165-86f146b3bc1c | 5 | @Test
public void testValue() {
System.out.println("value");
Equals<Double> instance = this._instance;
for (int i = 0; i < this._values.length; i++)
for (int j = 0; j < this._values.length; j++) {
boolean expResult = true;
for (Equals<Double> e : t... |
4bca78c8-d22d-42fb-b6d1-bfe302a6deab | 4 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.edittourist");
try {
resaveParamsSaveOrder(request);
Criteria criteria = new Criteria();
Order order = (Order) r... |
840293b1-e1cc-42e5-a465-0a7ef3343d03 | 9 | public boolean sendRMessages() throws PostServiceNotSetException{
//System.out.println("Sono nella sendR");
if (this.postservice == null){
throw new PostServiceNotSetException();
}
boolean atLeastOneUpdated = false;
switch (Athena.shuffleMessage){
case ... |
eeb262a9-3c03-4260-a1c8-d90682833b25 | 4 | public static void main(String[] args) throws Exception{
ArrayList<File> files = FileFinder.GetAllFiles("/home/lizhou/Desktop/nursing", "", true);
for(File f: files){
String name = f.getName();
@SuppressWarnings("resource")
PrintStream ps = new PrintStream(new FileOutputStream("/home/lizhou/Desktop/nursing... |
fccc70bb-805d-4a8d-9122-e88723d554cc | 8 | public Unit getUnitAt(Position p) {
if ( p.getRow() == 2 && p.getColumn() == 3 ||
p.getRow() == 3 && p.getColumn() == 2 ||
p.getRow() == 3 && p.getColumn() == 3 ) {
return new StubUnit(GameConstants.ARCHER, Player.RED);
}
if ( p.getRow() == 4 && p.getColumn() == 4 ) {
return new ... |
6bab5c03-a345-4900-bf8e-d1de61049e9e | 8 | public void twittThisInBehalf(String twitterMessage) {
try {
Twitter twitter = new TwitterFactory().getInstance();
try {
// get request token.
// this will throw IllegalStateException if access token is already available
RequestToken reques... |
73ba906a-f03a-4752-bf9d-39da4ed3c6b9 | 5 | @Override
public HandshakeState acceptHandshakeAsServer( ClientHandshake handshakedata ) {
if( handshakedata.getFieldValue( "Upgrade" ).equals( "WebSocket" ) && handshakedata.getFieldValue( "Connection" ).contains( "Upgrade" ) && handshakedata.getFieldValue( "Sec-WebSocket-Key1" ).length() > 0 && !handshakedata.getF... |
7580c2d5-a2d7-45cb-a487-d8b6401080c3 | 6 | private final void method641() {
synchronized (this) {
for (int i = 0; i < anInt5387; i++) {
int i_302_ = anIntArray5312[i];
anIntArray5312[i] = anIntArray5356[i];
anIntArray5356[i] = -i_302_;
if (aClass360Array5360[i] != null) {
i_302_ = ((Class360) aClass360Array5360[i]).anInt4427;
((Class36... |
8c128e45-66b1-4d56-ae39-f0a179ff9020 | 7 | protected void addItem() {
Item item = null;
CatItems sel = (CatItems) jCbItemType.getSelectedItem();
switch (sel) {
case GOODS:
String gDescr = jTextGoodsDescr.getText();
double gPrice = Double.valueOf(jTextGoodsPrice.getText());
int g... |
95a1b832-cb2a-4faf-ab91-4c56e89c772b | 1 | public void testMinus_Minutes() {
Minutes test2 = Minutes.minutes(2);
Minutes test3 = Minutes.minutes(3);
Minutes result = test2.minus(test3);
assertEquals(2, test2.getMinutes());
assertEquals(3, test3.getMinutes());
assertEquals(-1, result.getMinutes());
... |
594c898a-c60a-4639-bd04-808b0edc2118 | 1 | public void fall() {
point.setLocation(location);
point.translate(0, -1);
if (assertLegal(pane, block, point, block, location)) {
free();
location.translate(0, -1);
draw();
}
else {
sink();
}
} |
cccbc51a-81a7-40a2-bce9-d37bc3ab325e | 9 | private boolean crossingInternal(Point2D.Double direction1, Point2D.Double direction2) {
if (angles.size() < 2) {
return false;
}
final double angle1 = convertAngle(getAngle(new Line2D.Double(center, direction1)));
final double angle2 = convertAngle(getAngle(new Line2D.Double(center, direction2)));
Double... |
0f7dbef9-47df-4bcf-83ba-0b8a84f44872 | 8 | public void deleteFolder(String bucket, List<String> listFolders) throws Exception{
ListObjectsRequest listObjectsRequest;
ObjectListing objectListing;
for(String folderItem : listFolders){
if(!folderItem.trim().equalsIgnoreCase("/") && !folderItem.isEmpty()){
try {
... |
0ea7c3ab-de44-428e-9381-a49e064579a1 | 3 | public void setColor()
{
int truthState = getTruthState();
if(truthState==-1)
{
stateColor = Color.RED;
}
if(truthState==0)
{
stateColor = Color.YELLOW;
}
if(truthState==1)
{
stateColor = Color.GREEN;
... |
30ea5c1c-6f40-41ff-bb2f-45326bd27e70 | 2 | public final synchronized float readFloat(){
this.inputType = true;
String word="";
float ff=0.0F;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)ff = Float.parseFloat(word.trim());
re... |
ad4f2f44-a27b-4b47-b246-7dea5285a6e8 | 6 | @Override
public Serializable callMethod(String methodName, ArrayList<Object> params){
Object resu = null;
if(methodName.equals("deposit")){
try {
deposit((String) params.get(0), (double) params.get(1));
} catch (InvalidParamException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... |
f7de7e5a-c9c0-464f-9d71-48ec14c2e5fc | 4 | public boolean Equals(Move move){
return (this.initialRow == move.initialRow
&& this.initialCol == move.initialCol
&& this.finalRow == move.finalRow
&& this.finalCol == move.finalCol)?true:false;
} |
4fde7032-6747-422e-b7e8-fabd56d88832 | 1 | public void setCashOffice(CashOffice cashOffice) {
this.cashOffice = cashOffice;
if ( !cashOffice.exists(this)) {
cashOffice.addTicket(this);
}
} |
ebf17370-19bd-4be2-b66a-3911278abb42 | 3 | private void loadTexture(String pTextureUrl) {
if(pTextureUrl != null) {
Path texture = FileSystems.getDefault().getPath(pTextureUrl);
if(texture.toFile().exists()) {
try {
skyTexture = TextureIO.newTexture(texture.toFile(), true);
... |
2c7c2a13-6fb9-4d51-a2a5-984d1d3eb92f | 0 | public Game() {
super("Checkers");
setSize(WIDTH, HEIGHT);
setLocationRelativeTo(null); //lo centra nello schermo
this.board = new Board();
this.black=new Cpu(Board.BLACK, board);
setLayout(new GridLayout(8,8));
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowLis... |
656b5618-8c70-4145-bdd8-27a5dcdd4a1e | 8 | @Override
public Success<SourceFile> parse(String s, int p) {
p = optWS(s, p);
// Parse the module keyword.
Success<String> resModule = IdentifierParser.singleton.parse(s, p);
if (resModule == null || !resModule.value.equals("module"))
throw new NiftyException("Missing m... |
ecd1fa01-c952-4f42-8b91-1eb248e2228d | 6 | public Double[] maximizeMod(Double[] max, int[] numberOfValues, NodeVariable x, int xIndex, FunctionEvaluator fe, HashMap<NodeVariable, MessageQ> modifierTable){
if(debug>=3){
System.out.print("Oplus_MaxSum.maximizeMod: modifier table size="+modifierTable.size());
if (modifierTable.size... |
b83a6c0c-1859-447c-9f74-9ca9deeec3a9 | 0 | @Override
public void actionPerformed(ActionEvent e) {
exportOutlinerDocument((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(), getProtocol());
} |
0ab671d3-7dd2-4174-943b-53e6f935ff44 | 4 | public void disableAllBut(JButton[] b){
JButton allButton[] = {createMatrix, selectMatrix, deleteMatrix, helpButton, transposeButton, detButton, rowRedButton, inverseButton};
for(int i = 0; i<allButton.length; i++){
boolean disable = true;
for(int j = 0; j<b.length; j++){
if(b[j] == allButton[i])
dis... |
ddce1a2d-d401-4fdc-a1c0-26b3f2416cdb | 9 | private void appointmentManager(){
System.out.println("=========Appointment manager=========");
System.out.println("0: Back to main menu");
System.out.println("1: Show my appointments weekwise");
System.out.println("2: Show my appointments this week/month");
System.out.println("3: Make an appointment");
Sys... |
d7d31674-deac-4d69-aae4-4b185af66a6a | 9 | private void initListeners() {
PatchPanelMediator mediator = PatchPanelMediator.getMediator();
mediator.addDocumentChangedListener(new DocumentChangedListener() {
@Override
public void documentChanged(DocumentChangedEvent dce) {
document = dce.getDocument();
SwingUtilities.invokeLater(new Runnable() {... |
61d19abe-1f0d-47fe-8f32-94147a45ce5b | 1 | public boolean EliminarPlaga(Plaga p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
ec6004be-835d-4ebb-8fa0-144b7a9214ee | 7 | public static void main(String[] args) {
int[] summable = new int[28124]; // 0 will not be used
ArrayList<Integer> abundantnums = new ArrayList<>();
for (int i = 1; i <= 28123; i++) {
if (p21amicable.calcDivisors(i) > i) {
// System.out.println(i + " is abundant.");
... |
ecd3057e-65ab-45cb-97ff-e8726dba2eca | 4 | public void setLoglevel(LOGLEVEL loglevel)
{
if(loglevel == LOGLEVEL.Nothing)
{
logLevel = -1;
}
else if(loglevel == LOGLEVEL.Error)
{
logLevel = 0;
}
else if(loglevel == LOGLEVEL.Normal)
{
logLevel = 1;
}
else if(loglevel == LOGLEVEL.Debug)
{
logLevel = 2;
}
else
{
... |
b6fdb41c-c58b-4539-a602-26e50e74fd15 | 3 | public static void blockUntilProcessEnd(Process process, int timeOut) {
int maxCount = timeOut * 5;
for (int i = 0; i < maxCount && checkProcessEnd(process); i++) {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
logger.error(e);
... |
1a73188f-93ee-40d0-b596-f406de5dc628 | 5 | public boolean sameBearingAsNearFriend(double[] position, double bearing) {
for (double[] agentVals : agentInfo.values()) {
double normal = Math.abs(agentVals[2] - bearing);
if (normal >= 345 || normal <= 10) {
//Similar heading, check proximity.
if (agent... |
4b561da4-a4ff-4480-bcdc-24e6a565f57c | 2 | public void visitArithExpr(final ArithExpr expr) {
if (previous == expr.left()) {
previous = expr;
expr.parent.visit(this);
} else if (previous == expr.right()) {
check(expr.left());
}
} |
74022dac-7486-4043-8055-617bbdcc5271 | 6 | public boolean isNearlyTridiagonal(double tolerance){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(i<(j+1) && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false;
if(j>(i+1) && Math.ab... |
3fadca49-8810-443e-91d2-4e00319e8d78 | 3 | public void toFtanML(Writer writer) {
try {
writer.append("[");
Iterator<FtanValue> iterator=values.iterator();
if(iterator.hasNext()) {
iterator.next().toFtanML(writer);
while(iterator.hasNext()) {
writer.append(",");
iterator.next().toFtanML(writer);
}
}
writer.append("]");
... |
d19d9d92-0712-4ea2-aebf-3a53a3300ea3 | 4 | public ArrayList<TreeRow> getSelectedRows() {
ArrayList<TreeRow> selection = new ArrayList<>();
if (!mSelectedRows.isEmpty()) {
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (mSelectedRows.contains(row) && !isAncestorSelected(row)) {
selection.add(row);
}
}
}
ret... |
cbd5527e-8cb5-413a-8764-898603af22e8 | 8 | public boolean checkArc(Arc paArc, Graph graph) {
Element p1 = paArc.getOutElement();
Element p2 = paArc.getInElement();
// Petri Net - Place / Transition
if (graph instanceof PetriNet) {
if (((p1 instanceof AbsPlace) && (p2 instanceof Transition)) | ((p2 instanceof AbsPlace... |
25d03823-0103-496a-8cef-87c9b235cc49 | 4 | public boolean save(File file) {
checkPaths();
file.getParentFile().mkdirs();
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException ex) {
Debug.p("Deck file could not be created: "
+ file + ": " + ex... |
241e2296-7df9-44e0-8d40-e49fc651c3d8 | 1 | */
public InferenceParameters getHLQueryProperties() {
synchronized (defaultQueryProperties) {
if (!queryPropertiesInitialized) {
initializeQueryProperties();
}
return (InferenceParameters) defaultQueryProperties.clone();
}
} |
1d688e28-91da-4d0a-9b52-0d7a82ed500a | 0 | public void setDiscount(float discount) {
this.discount = discount;
} |
3b54cb07-87b4-4a7c-9783-8d0211db388c | 0 | public ISocketServerConnection getClientConnection() {
return clientConnection;
} |
2134b49a-2ce3-4385-a9ee-297aec80c84e | 1 | protected static boolean removeProtection(Path file) {
assert FileUtil.control(file);
boolean ret = false;
String cmdTmp = SAVEACL_CMD_1 + file.toString() + SAVEACL_CMD_2 + acl + file.getFileName().toString().replaceAll("\\.", "")
+ SAVEACL_CMD_3;
cmdTmp += AND + TAKEOWN... |
e869b1aa-c799-4949-a332-0061b9974483 | 9 | @Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_W) upPressed = true;
if(e.getKeyCode() == KeyEvent.VK_S) downPressed = true;
if(e.getKeyCode() == KeyEvent.VK_A) leftPressed = true;
if(e.getKeyCode() == KeyEvent.VK_D) rightPressed = true;
if(e.getKeyCode() == KeyEvent.VK_1) one... |
a777c323-38c6-4dce-9741-aeb614f1a119 | 3 | public Object getValue(Object obj,String propName) {
Object val = null;
PropInfo propInfo = propInfoByPropName.get(propName);
if (propInfo != null){
Method readMethod = propInfo.getReadMethod();
if (readMethod == null){
throw new RuntimeException(format("propName %s does not not have readMethod",propNam... |
d1085700-72ee-4cc3-9e04-50aa91051715 | 4 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
@SuppressWarnings("unchecked")
Map<Integer,Integer> mandje = (Map<Integer,Integer>)request.getSession().getAttribute(MANDJE);
int nummer = 0;
try {
nummer = Integer.parseInt(request.getParame... |
70b2a8b8-689c-48ab-8eff-433a32dfe0c1 | 0 | @Test
public void testCheckCbolOriginalDir() {
new DirCbol().checkCbolOriginalDir();
new DirCbol().checkCbolOriginalDirV2();
new DirCbol().checkCbolOriginalDirV3();
new DirCbol().checkCbolOriginalDirV4();
} |
9184acbd-4f45-466f-8a71-bd823e8d693b | 0 | @SuppressWarnings("unchecked")
public List<Product> retrieveAllProducts() {
return em.createNamedQuery("findAllProducts").getResultList();
} |
1a0a0eb3-e679-4253-88f9-f9d6eb1a31c3 | 1 | public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray)o : null;
} |
0ce0cb66-397a-4b61-bcc9-fdcc6f9d428a | 7 | private int deleteFileFromStorage(String fileName, boolean deleteMaster,
boolean justTest) {
Storage tempStorage = null;
File tempFile = null;
int msg = DataGridTags.FILE_DELETE_ERROR;
for (int i = 0; i < storageList_.size(); i++) {
tempStorage = (Storage) storag... |
9e78ba53-9ffc-4e6b-ba79-7e45c1e294d4 | 2 | public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
// Award a bonus to... |
52a8c86c-f132-440b-b702-9825214cbd1c | 0 | @Test
public void testCheckValidForTournament() throws Exception {
System.out.println("checkValidForTournament");
World instance = new World();
instance.readInWorld("2.world");
boolean expResult = true;
boolean result = instance.checkValidForTournament();
assertEquals... |
0a494f29-4039-459f-9fe8-0c87acf56be5 | 3 | protected synchronized boolean isFullLine(int yCoordinate) {
boolean isFullLine = true;
int minX = lowerLimit.getX();
int maxX = upperLimit.getX();
for (int currentX = minX; currentX<=maxX; currentX++) {
Point point = new Point(currentX, yCoordinate);
if (isInGridRange(point)) {
... |
83eedd12-daaf-43c7-bdb2-495b619fe2ef | 5 | public void alustaPeliLauta() {
x = 30;
y = 600;
s = 300;
r = 600;
p = 30;
q = 30;
winCondition = 0;
arvausMaara = 0;
vari = -1;
rivi = 0;
sarake = 0;
vinkkiRivi = 0;
oikeaKoodi = new kuvio[4];
for (int i = 0... |
b27afe72-932c-46c1-9851-16fb08c191d6 | 4 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(finish)){
ansname = name.getText();
anstype = type.getText();
ansx = xsize.getText();
ansy = ysize.getText();
if(tset == null){
tset = new TileSet();
... |
19798232-4a06-4534-8c2f-2a9a874ded01 | 7 | public static String getTextBetweenNestedDelims( String originalText, String beginDelim, String endDelim )
{
StringBuffer sb = new StringBuffer( originalText.length() );
// Check to see that both delimiters exist in the string
if( (originalText.indexOf( beginDelim ) < 0) || (originalText.lastIndexOf( endDelim ) ... |
7f48b682-6c46-4d84-a851-8cd9c4cc0011 | 1 | public void createSong(BESong aSong) throws Exception {
try {
ds.createSong(aSong);
m_songs.add(aSong);
} catch (SQLException ex) {
throw new Exception("Could not create the song " + aSong.getTitle());
}
} |
47597340-1233-4656-9b0f-8a687a16aca7 | 3 | public void drawShapedSprite(int height, int arg1, int dest[], int arg3, int src[], int arg5, int arg6, int arg7, int width, int arg9) {
try {
int j2 = -width / 2;
int k2 = -height / 2;
int sineStep = (int) (Math.sin(arg1 / 326.11000000000001D) * 65536D);
int cosStep = (int) (Math.cos(arg1 / 326.110000000... |
8f6f5bc6-18f9-4bab-a6e3-6c3c39422013 | 9 | @SuppressWarnings("deprecation")
public static void main(String[] args) {
HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>();
HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>();
HashMap<Integer, String> stationIdName... |
074711b9-6be7-4946-b23c-a09e7a7c49e7 | 3 | public String getEntryText(int pos) {
int current = 0;
for (Widget i = wdg().child; i != null; i = i.next) {
if (i instanceof TextEntry) {
current++;
if (current == pos) {
TextEntry te = (TextEntry) i;
return te.text;
}
}
}
return "";
} |
9e78bde2-bfa1-43a9-84e8-11ea6f445e8b | 2 | public static void saveFile(INIFile file, String path){
FileUtility.createFile(path);
ArrayList<String> contents = new ArrayList<String>();
for(INISection section : file.getSections()){
String sectionOutput = "[" + section.getName() + "]";
contents.add(sectionOutput);... |
078d6fcc-3356-41ab-a3ab-dab88e51d5cd | 5 | public boolean equals(
Object o)
{
if (o == null || !(o instanceof ASN1Sequence))
{
return false;
}
ASN1Sequence other = (ASN1Sequence)o;
if (this.size() != other.size())
{
return false;
}
Enumeration s1 = this.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.