method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
977d2141-b8ca-4553-8edf-c57a1bfaf8d3 | 5 | public void insert(String in)
{
if(this.isEmpty())
{
Nodes dataList = new Nodes(in);
head = dataList;
}
else if(in.compareTo(this.getData(numberOfItems - 1)) >= 0)
{
Nodes prev = search(numberOfItems - 1);
Nodes newItem = new Nodes(in);
prev.next = newItem;
}
else if(in.compareTo(this.getD... |
2d5c5707-9c30-4fc6-a52d-fb3c9f5d1cf1 | 6 | public void close() throws IOException {
if ( this.mBufferedOutputStream != null ) {
boolean delete = false;
try (BufferedInputStream input = new BufferedInputStream( new FileInputStream( this.mTempFile ) )) {
this.mBufferedOutputStream.flush();
this.mBufferedOutputStream.close();
((WaveFileHeader) ... |
6cc500ef-6af1-4801-993f-ef058642b337 | 1 | public String status() {
return "#" + id + "(" + (countDown > 0 ? countDown : "LiftOff!") + "), ";
} |
139b35bd-8ed3-41d7-964d-fd0066d34d89 | 7 | @SuppressWarnings("resource")
public void menu(DataSource ds) {
while (true) {
try {
System.out.println("Main Menu");
System.out.println("1.Prescribing New Medication");
System.out.println("2.Medical Test Update");
System.out.println("3.Patient Information Update");
System.out.println("4.Searc... |
74ad9bf1-43e4-4762-9897-0b39fad6fd9f | 2 | public void disposeShaders() {
if (vert != 0) {
GL20.glDetachShader(getID(), vert);
GL20.glDeleteShader(vert);
vert = 0;
}
if (frag != 0) {
GL20.glDetachShader(getID(), frag);
GL20.glDeleteShader(frag);
frag = 0;
}
... |
aedee889-5b64-40a3-bd82-882d13172249 | 5 | public void DrawNumbersToInstantiate(Graphics gr)
{
int numberX = numberInstantiateX;
int numberY = numberInstantiateY;
int numerToPrint = 1;
float tempDrawX = numberX;
int drawX = (int) tempDrawX;
Stroke stroke = new BasicStroke(2);
((Graphics2D) gr).setStroke(stroke);
gr.setColor(Color.black);... |
86d01035-7ef7-4f6f-a4fe-2322409aeeb4 | 5 | public boolean validateMove(String pieceID, int fromPosition, int toPosition, int fromPosition2, int toPosition2) {
boolean valid;
if (currentCard.getRank() == 7){
if (valid = board.validateMove(currentCard.getRank(), pieceID, fromPosition, toPosition, fromPosition2, toPosition2)){
... |
56a7caa3-995b-491c-a12a-54778f5f2a73 | 1 | public static void main(String[] args)
{
int p[] = { 0, 1, 5, 8, 9, 10, 17, 17, 20, 24, 30 };
int n = 10;
BURodCutting bu = new BURodCutting(n, p);
System.out.println("Read as, Length of Rod : Cuts : Maximal Revenue");
for (int i = 1; i <= bu.n; i++)
System.out.println(i + " : " + bu.cuts[i] + " : " + bu... |
112d45a6-2180-44bf-9d1c-2ce6c95788e5 | 1 | public void raise(int x, int y) {
_map[y][x] += 256;
if (_map[y][x] > 1024) _map[y][x] = 100000;
} |
375b15ff-efdd-4c9d-a924-a231c1df3175 | 3 | @Override
public final Store findStore(String storeNo){
Store storeFound = null;
for(int i = 0; i < stores.length; i++){
if (storeNo.equals(stores[i].getStoreNo())){
storeFound = stores[i];
break;
}
}
if(storeFound == null) {
... |
1634fb49-c44a-4b8d-b47e-4288b754d7d8 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Solido other = (Solido) obj;
if (this.id != other.id) {
return false;
}
if (!... |
339f18cd-d502-451f-bc1b-50c9e34daebf | 6 | @Override
public WriteMsg write(FileContent data) throws RemoteException, IOException {
String fileName = data.getFileName();
// check if this is a commit acknowledgment
if (data.getData() == null) {
synchronized (this) {
ReplicaLoc[] locations = locMap.get(fileName);
metaDataWriter.write(fileName);
... |
26347f75-9164-48dc-83b4-fa78bb8524ee | 5 | public static void readMappings(InputMap im) {
Preferences bindings = PREFS.node("bindings"); //$NON-NLS-1$
try {
boolean changed = false;
for (String key : bindings.keys()) {
String act = bindings.get(key, null);
if (act != null) {
changed = true;
im.put(JoshText... |
e3288c04-c55a-4902-a674-b4852ef7984a | 4 | private boolean isLocationInPicture(int column, int row)
{
boolean result = false; // the default is false
if (column >= 0 && column < picture.getWidth() &&
row >= 0 && row < picture.getHeight())
result = true;
return result;
} |
e763d81a-f167-47ed-9ca2-9e2e512bd5ac | 8 | public Boolean isPermtation( String string1, String string2) {
if (string1 == null && string2 == null) {
return true;
} else if(string1 == null && string2 !=null) {
return false;
} else if(string2 == null && string1 !=null){
return false;
} else {
... |
f9f32b01-95c2-4333-b7f2-c251c1a9c88a | 5 | @Override
public void onDisable() {
if(!restarting) {
if(config.getBoolean(ServerRestarterConfigNodes.CREATE_STATE_FILE)) {
File file = new File(config.getString(ServerRestarterConfigNodes.STATE_FILE));
if(file.isDirectory())
getLogger().severe("Status file is a directory!");
if(file.exists() && ... |
a7246992-e576-4455-a94c-0cc763a06f1d | 7 | public void init()
{
Context.initialize();
// Create a Session
_session = Session.acquire(CommandLine.variable("session"));
if (_session == null)
{
System.out.println("Could not acquire session.");
Context.uninitialize();
System.exit(1);
... |
8de10594-0444-491f-9dce-c1253a8c566d | 7 | void getNeighbors() {
neighborCount = 0;
if (disregardNeighbors)
return;
AtomIterator iter =
frame.getWithinModelIterator(atomI, radiusI + diameterP +
maxRadius);
while (iter.hasNext()) {
Atom neighbor = iter.next();
if (neighbor == atomI)
... |
efb98a86-18f4-4257-8239-bedca00654f2 | 1 | private void addOximata(){
/*
* vazei ta oximata tis vashs sthn lista
*/
ArrayList<String> oximata=con.getOximata();
for(int i=0;i<oximata.size();i++){
listModel.addElement(oximata.get(i));
}
} |
ef03dcf2-e773-4696-aaab-40327f05f5f7 | 8 | private static boolean isLongFilename( String filename )
{
if( filename.charAt( 0 ) == '.' || filename.charAt( filename.length() - 1 ) == '.' )
return true;
if( !filename.matches( "^\\p{ASCII}+$" ) )
return true;
// no matter whether it is file or directory
int dotIdx = filename.lastIndexOf( '.' );
S... |
cfe874f7-381f-4370-a765-adaee12f7f0d | 1 | public void imLis(ArrayList<ConstansToken> g) {
for (ConstansToken g1 : g) {
System.out.println(g1.getSimbolo() + " " + g1.getMatch() + " " + g1.getValor());
}
} |
a562d372-0796-49ce-856f-4db2fe1e61a8 | 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 Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.id == null && other.id != null)... |
1b3dbfa9-beb0-490c-b1f1-b2303f72d90b | 6 | public void step(SimState state) {
Sim.instance().clearOGroups();
Bag freshmen = new Bag();
for(int i = 0; i < Sim.FRESHMAN_CLASS_SIZE; i++){
Student.Race race;
Student.Gender gender;
float racePercent = Sim.instance().random.nextFloat();
if(rac... |
8c2858fc-3d0a-4bfa-a0da-2042fc647916 | 4 | @Override
public void run() {
while(true) {
try {
Socket socket = server.accept();
BufferedReader inFromClient =
new BufferedReader(new InputStreamReader(socket.getInputStream()));
... |
55af9de4-8330-401a-b0cc-47f6c5c8659c | 0 | public void setMessageAuthScheme(SignatureMethodType value) {
this.messageAuthScheme = value;
} |
80c521e4-5ef1-4199-8a3c-ff0814063059 | 5 | public static void getHelp(Player p, String page) {
int pg = 1;
int tpg = getTotallHelpPG();
if (!page.equalsIgnoreCase("")) {
try {
pg = Integer.parseInt(page);
} catch (Exception e) {
MessageManager.getInstance().error(p, page + " is not a number");
return;
}
}
if (pg > tpg) {
pg = 1... |
03a5990d-b5c2-45ff-a171-992836e0289d | 1 | @Override
public String getPotentialContentSizeChangeActionCommand() {
if (mOutlineToProxy != null) {
return mOutlineToProxy.getPotentialContentSizeChangeActionCommand();
}
return super.getPotentialContentSizeChangeActionCommand();
} |
70ef186b-dd41-46aa-9965-a9cbf0c31183 | 2 | @Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} |
2aace461-1a02-42dc-8be4-b9f93ccc3f6a | 8 | public static void multTransA_small( RowD1Matrix64F A , D1Matrix64F B , D1Matrix64F C )
{
if( C.numCols != 1 ) {
throw new MatrixDimensionException("C is not a column vector");
} else if( C.numRows != A.numCols ) {
throw new MatrixDimensionException("C is not the expected len... |
a1c07204-6fe3-4348-9465-9d73fbf7ff8b | 9 | protected static Ptg calcRows( Ptg[] operands ) throws FunctionNotSupportedException
{
try
{
int rsz = 0;
if( operands[0] instanceof PtgStr )
{
String rangestr = operands[0].getValue().toString();
String startx = rangestr.substring( 0, rangestr.indexOf( ":" ) );
String endx = rangestr.substrin... |
d95fb5e7-02ff-454b-a9fb-3f586d5e042a | 4 | public void stopDiagonal(int otherX, int otherY) {
if (c.freezeDelay > 0)
return;
if (c.freezeTimer > 0) //player can't move
return;
c.newWalkCmdSteps = 1;
int xMove = otherX - c.getX();
int yMove = 0;
if (xMove == 0)
yMove = otherY - c.getY();
/*if (!clipHor) {
yMove = 0;
} else if (!cl... |
ab06777b-b65f-426c-b7e2-12d8e245271a | 2 | private static boolean doesListContain(String value, List<String> names){
boolean contains = false;
for(String name : names)
{
if (name.contains(value))
contains = true;
}
return contains;
} |
90026dc3-8300-4e66-b85d-0fb9845196a8 | 5 | @EventHandler
public void onBlockPistonExtend(final BlockPistonExtendEvent event){
BlockFace facing = event.getDirection();
if (plugin.gates.isGate(event.getBlock().getRelative(facing))){
plugin.verbose("Piston tried to mess with a KonseptGate by pushing it! BOO!!");
event.s... |
eb25268e-d5b1-4ad9-b5e9-5531b48daf8b | 5 | public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int d1 = in.nextInt();
int d2 = in.nextInt();
int work = d1*n;
int z = work/d2+((work%d2>0)?1:0);
for (int i = ... |
1ce0ce22-439d-4eb7-9643-f4797072820f | 5 | @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("<tr><td colspan ='3'>");
sb.append("<h3>Experience: ").append(getTitle()+"</h3><br />");
sb.append("Created by: ").append(getCreator()+"<br />");
if(isShared()){
TimelineResource res =... |
895bf027-281c-460d-a3ee-444d1724b7dc | 4 | public static HashMap unpack(ByteBuffer buf)
{
HashMap data = new HashMap();
int index = 0;
while (buf.hasRemaining())
{
switch (buf.getInt())
{
case 0:
int valui = buf.getInt();
data.put(index, valui);
... |
d187c0ad-d6d9-47a3-b6ca-519cb0a82c54 | 3 | public void AImove(Ball ball, int height) {
cnt++;
if (cnt == 2) {
cnt = 0;
//center = (y + (length / 2));
if (y + length < ball.getY() + ball.getRadius()) {
moveDown();
}
if (y > ball.getY()) {
moveUp();
... |
d15fd227-f5f5-4a2b-a969-d6c1e53d9aa2 | 7 | public void slaughter(GameWorld gw) {
gw.map[y][x].blood += 1500;
for (int dy = -1; dy < 2; dy++) {
if (y + dy < 0 || y + dy >= gw.map.length) { continue; }
for (int dx = -1; dx < 2; dx++) {
if (x + dx < 0 || x + dx >= gw.map[y].length) { continue; }
if (gw.r.nextInt(3) == 0) {
gw.map[y + dy][x +... |
339ce426-ebf7-4975-bcd8-1edea0decb0d | 0 | public void setExteriorRing(List<LngLatAlt> points)
{
coordinates.add(0, points);
} |
473de1a2-198d-4788-bd40-d5df7d739f92 | 7 | public boolean hit(ArrayList<Bullet> bullets,int damage){
if( this.isAlive() ){
for(Bullet b:bullets){
//ӵŵʱɱ
if( b.isAlive() && b.getId()!=id ){
if(inside(b)){
//HP
if( hp>0 ){
hp = hp - damage;
}
if( hp<=0 ){
this.setAlive(false);
cx = this.x;
... |
a4e3703c-d70c-4ac5-83b6-0574d8cdc97e | 8 | @Override
public void mousePressed(MouseEvent e) {
if (e.getX() < 0 || e.getY() < 0 || e.getX() > Minesweeper.myWidth * Minesweeper.SIZE || e.getY() > Minesweeper.myHeight * Minesweeper.SIZE) {
return;
}
boolean left = e.getButton() == MouseEvent.BUTTON1,
right = ... |
c8b2bccf-deb9-4a0d-a7d1-335a619d9dc1 | 6 | static public Vector3f findTetrahedronSimplex(List<Vector3f> simplex){
//A is the point added last to the simplex
Vector3f a = simplex.get(3);
Vector3f b = simplex.get(2);
Vector3f c = simplex.get(1);
Vector3f d = simplex.get(0);
Vector3f ao = a.negate();
V... |
e020f5fa-7b09-4147-ae02-f89002fbd454 | 5 | public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
final int n = 2;
MethodOfEilerN.iterCount = 0;
System.out.println("y(k+1)[0] | y(k+1)[1] | t(k+1) ");
while (tk <... |
c78f1f91-e5de-4509-859a-7d019dcbaf15 | 1 | private void initialize(){
frame.setTitle("Learn-Words");
frame.setIconImage(MAIN_ICON.getImage());
frame.setSize(WINDOW_SIZE);
// setResizable(false);
frame.setMinimumSize(MIN_WINDOW_SIZE);
frame.setLocation((int) (SCREEN_SIZE.getWidth() / 2 - frame.getWidth() / 2),
... |
070380eb-7abd-4f17-b4c7-040d9f4b55e6 | 8 | public void loadLayout(InputStream stream) {
Chrono c = new Chrono("loadLayout");
XMLDecoder d = new XMLDecoder(new BufferedInputStream(stream));
Node model = (Node) d.readObject();
Map<?, ?> m = (Map<?, ?>) d.readObject();
d.close();
this.splitPanels.removeAll();
try {
for (Entry<?, ?> e : m.entrySe... |
6575d300-81b2-4c22-ad06-cb8685ae76fa | 7 | public void parse(String fileName){
int i,j;
Sentence s;
NodeList sentences = doc.getElementsByTagName(XML_NODE_SENTENCE);
Node sentenceNode;
Element sentenceElement;
WordSW w;
NodeList words;
Node wordNode;
Element wordElement;
String li... |
d3f74ff6-bca7-4d91-9a97-0dc2651978a0 | 5 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("ALTER TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n ");
if(this.ren) {
sB.append(" RENAME TO ");
sB.append(this.renTo.repla... |
9c3f9102-8a11-4969-b23e-1d2bc2818267 | 2 | public static boolean isHellSkeleton (Entity entity) {
if (entity instanceof Skeleton) {
LeatherArmorMeta chestMeta;
ItemStack HSC = new ItemStack(Material.LEATHER_CHESTPLATE, 1,
(short) - 98789);
chestMeta = (LeatherArmorMeta) HSC.getItemMeta();
... |
54110f99-fa29-4444-9def-50381c536a1b | 4 | @SuppressWarnings("rawtypes")
public static void printList(AbstractList list, int depth)
{
final Iterator i = list.iterator();
Object o = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("List: ");
while (i.hasNext() && (o = i.next... |
90bd5161-f2bf-4554-8826-77d42b4f1cdb | 0 | public Map<Integer, String> getGlobalStringPool() {
return this.stringTable;
} |
8860fb3d-4a3a-4c9a-b61a-b31f051299e3 | 4 | @Test(groups = { "Integer-Sorting", "Primitive Sort" })
public void testSelectionSortInt() {
Reporter.log("[ ** Selection Sort ** ]\n");
try {
testSortIntegers = new SelectionSort<>(
primitiveShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMill... |
10ef5fdd-6d01-45e3-af4b-0ced7a1bf044 | 6 | public Word[] verboseAlternatives(Word wordizedSearch){
int n = wordizedSearch.getWord().length();
Word[] words = this.getAlternatives(wordizedSearch);
if(dictionary.contains(wordizedSearch))
return new Word[] {wordizedSearch};
try{
FileWriter fw = new FileWriter(wordizedSearch.getWord() + ".txt");
... |
fbbbe8d7-a7f1-4b5b-8f1b-8f298684c5fc | 8 | public int findThreat(){
int index=-1;
for(int q=0;q<objects.size();q++) {
if (objects.get(q) == this||objects.get(q).kind==kind||objects.get(q).kind==0)
continue;
int searchRadius = 400; //radius of whether the object will be findable
boolean search =... |
d4f07af0-5d8b-4651-bf41-a82dfe1d331c | 0 | @Override
public boolean removeGroup(String group) {
return groups.remove(group);
} |
ad7c8a3b-93ae-41fc-971c-4af15aadc78c | 3 | @Override
public void done()
{
try
{
StringBuilder result = get();
textArea.setText(result.toString());
statusLine.setText("Done");
}
catch (InterruptedException ex)
{
}
catch (CancellationException ex)
... |
702a075f-3480-445b-b38e-74a69726ac1a | 3 | public void runStep () {
ArrayList<Node> readyNodes = new ArrayList<Node>();
for (Node node : _nodes) {
if (node.getReady()) {
readyNodes.add(node);
}
}
for (Node node : readyNodes) {
node.sendTrigger();
}
} |
f38cb6f8-e1ff-42f4-9d83-290829bb870e | 0 | public VueConnexion(CtrlAbstrait ctrlA) {
super(ctrlA);
initComponents();
VueAbstrait vueA = null;
this.ctrl = new CtrlConnexion(this, vueA);
} |
2968dc71-4fa4-4350-8a19-7b0f7844019d | 8 | public Object parse(String original) throws ValidatorException {
LinkedHashMap<String, String> map = new LinkedHashMap<String,String>();
String[] lines = original.split("\\n+");
for (String line : lines) {
String[] tokens = line.replaceFirst("^\\s+","").split("\\s+");
if (tokens.length > 2)
throw new V... |
b57cc281-8102-43bd-ac11-6976e15a3041 | 8 | private void doread(ScanfReader scanReader)
throws IOException {
chartData.setEntryList(new Vector<ChartEntry>(10));
HashMap<String, Color> colorList = new HashMap<String, Color>(10);
boolean attributesRead = false;
colorList.put("red", Color.red);
colorList.put("gr... |
8f325d1c-65de-44a2-913c-bcd4a775b5bc | 2 | public static Long parseNumericStringObject(Object object) throws InvalidRpcDataException {
if (object == null) {
return null;
}
if (object instanceof String) {
return parseNumericString((String) object);
} else {
throw new InvalidRpcDataException("... |
f893323e-d1da-448f-839e-93a49c740df4 | 6 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MessageBlockDef other = (MessageBlockDef) obj;
if (!getOuterType().equals(other.getOuterType())) {
return... |
c90fd919-972f-462d-9c9e-3b253be63136 | 0 | public Long getFilmId() {
return filmId;
} |
08864427-4138-47e3-90a0-a62516ba5f2f | 4 | public static String postXml(String content,String postUrl) throws IOException{
OutputStreamWriter out = null;
URLConnection con=null;
BufferedReader br = null;
try {
URL url = new URL(postUrl);
con = url.openConnection();
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestProperty("P... |
8a46635e-c214-4942-9c84-6f6533b5af11 | 7 | public void checkPKReward() {
if(pkpoints == 500000) {
addItem(1038, 1);
sendMessage("Congratz on getting "+pkpoints+" pk points! Have a phat =)");
}
if(pkpoints == 750000) {
addItem(1040, 1);
sendMessage("Congratz on getting "+pkpoints+" pk points! Have a phat =)");
}
if(pkpoints == 100000) {
addItem(1042, 1);
sendMes... |
3990d569-a9a5-4c4e-afdc-aa9074fc53a1 | 7 | public static boolean isInteger(String s) {
if (s == null || s.length() == 0) {
return false;
}
char c = s.charAt(0);
if (s.length() == 1) {
return c >= '0' && c <= '9';
}
return (c == '-' || c >= '0' && c <= '9') && onlyDigits(s.substring(1));
... |
288340b5-18f5-448f-9167-8f697a583edc | 0 | public String getEmail() {
return this.email;
} |
2d2809c5-5e5f-4bcc-b95f-6d4b3bdd56c3 | 0 | private void applyChanges() {
updateGUI();
// Record all the changes.
docSettings.getLineEnd().applyTemporaryToCurrent();
docSettings.getSaveEncoding().applyTemporaryToCurrent();
docSettings.getSaveFormat().applyTemporaryToCurrent();
docSettings.getOwnerName().applyTemporaryToCurrent();
docSettings.get... |
b3415deb-2724-48c7-a87b-c88a202a3fb6 | 4 | @Test
public void TestAll() throws IOException, SyntaxFormatException {
for (File file : new File("src/test/resources/testprogs/").listFiles()) {
if (file.isFile()) {
if (file.getPath().indexOf(StatementTest.simpleFuncTest4) >= 0) {
continue;
}
if (!file.getPath().endsWith(".txt")) {
continu... |
366f3ace-dfec-4b8b-b996-a752eb47cce2 | 0 | public Scheduler get()
{
return scheduler;
} |
2af1f00f-03af-4ae2-bd7d-fd5db5f5dff1 | 1 | public void setOption(String option, Collection values) {
if (option.equals("all")) {
onlySUID = false;
} else
throw new IllegalArgumentException("Invalid option `" + option
+ "'.");
} |
0733f1cb-c3d3-4604-8a35-d50df05d0e81 | 8 | Edge enter(Node branch) {
Node n;
Edge result = null;
int minSlack = Integer.MAX_VALUE;
boolean incoming = getParentEdge(branch).target != branch;
// searchDirection = !searchDirection;
for (int i = 0; i < graph.nodes.size(); i++) {
if (searchDirection)
n = graph.nodes.getNode(i);
else
n = gra... |
6955e6c5-1774-4983-8fdf-fea59c133707 | 5 | public void register(final JComponent showDate) {
this.showDate = showDate;
showDate.setRequestFocusEnabled(true);
showDate.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
showDate.requestFocusInWindow();
}
});
... |
c1e3447b-efc8-4d1a-9b8b-da8fa7ea4b34 | 1 | public void testDividedBy_int() {
Minutes test = Minutes.minutes(12);
assertEquals(6, test.dividedBy(2).getMinutes());
assertEquals(12, test.getMinutes());
assertEquals(4, test.dividedBy(3).getMinutes());
assertEquals(3, test.dividedBy(4).getMinutes());
assertEquals(2, te... |
1beba52d-90dd-495e-ac90-bed25e7ff44c | 6 | @EventHandler(priority = EventPriority.LOW)
public void onEntityDeath(EntityDeathEvent e) {
final Entity player = e.getEntity();
for (String worldname : WorldSettings.worlds) {
if (e.getEntity().getWorld().getName().equals(worldname)) {
if (Settings.onDeath) {
e.getDrops().clear();
return;
}
... |
29e8de45-4410-4db2-9044-039e31744e1a | 5 | public final SymbolraetselASTNormalizer.start_return start() throws RecognitionException {
SymbolraetselASTNormalizer.start_return retval = new SymbolraetselASTNormalizer.start_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTre... |
649c877a-f308-4707-bcde-1fa22709f4db | 3 | private void jButtonCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCalcActionPerformed
/**This method calculates Monthly Mortgage Payment**/
/**Get Input**/
//Get the vlaue of the text fiels
sPrinciple = jTextFieldPrincipal.getText();
... |
325a3346-3cd1-40b8-8137-6d610ad3204d | 2 | public static byte[] serialize(Inventory items) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
NbtTagCompound nbtTagCompound = NbtFactory.toCompound(NbtFactory.createTag(NbtType.TAG_CO... |
b57220de-d9e2-4d11-8529-e83dc3f12edd | 4 | public static Mask buildPrewittMask(Direction d) {
switch (d) {
case HORIZONTAL:
double[][] dValues = { { 1, 0, -1 }, { 1, 0, -1 }, { 1, 0, -1 } };
return new Mask(dValues);
case VERTICAL:
double[][] aValues = { { 1, 1, 1 }, { 0, 0, 0 }, { -1, -1, -1 } };
return new Mask(aValues);
case DIAGONAL:
... |
d7957b6e-6444-4976-92f2-ede9f12953ba | 6 | public static boolean isValidIPAddress(String s) {
String[] nums = s.split("\\.");
if (4 != nums.length) return false;
for (int i = 0; i < nums.length; i++) {
if (nums[i].startsWith("0") && nums[i].length() > 1) return false;
int n = Integer.parseInt(nums[i]);
if (n > 255 || n < 0) re... |
c3a82889-5592-42b5-accf-96b9530fc20a | 4 | public static String[] parse(String name) throws IOException, NavException, XPathParseException, XPathEvalException, ParseException{
File f = new File(name);
FileInputStream fis = new FileInputStream(f);
byte[] b = new byte[(int) f.length()];
fis.read(b);
VTDGen vg = new VTDGen();
vg.setDoc(b);... |
5cde5c32-c905-4977-83d0-7efe8fabdffe | 6 | public static void unit_test( final int ARRAY_SIZE ) {
SortAlgorithm[] algorithms = {
new InsertionSort(),
new BubbleSortForLoop(),
new BubbleSortUntilLoop(),
new SelectionSort(),
new MergeSort(),
new InPlaceQuickSort( new LastElementAsPivot() )
};
for( SortAlgorithm algo : algorithms ... |
f629adde-71d0-4efc-a350-c9ff754f62c0 | 5 | public void writeStep(int r, int s, Step step, Data stepData, double finalOF) {
checkFile();
if (w != null) {
this.writeStepHeader();
w.println("-------------------------------");
w.println("Round " + (r+1) + " Step " + step.getName());
... |
cd7a5d58-e32d-4fc7-b946-77bf891b7f7b | 3 | public String getWhois(final String domainName) {
StringBuilder result = new StringBuilder("");
try {
WhoisClient whois = new WhoisClient();
whois.connect(WhoisClient.DEFAULT_HOST);
// whois =google.com
String whoisData = whois.query("=" + domainName);
result.append(whoisData);
whois.disconnect(... |
874c9087-0c7e-4a4f-b411-c207efb17a74 | 1 | protected static boolean resetProtection(Path file) {
assert FileUtil.control(file);
boolean ret = false;
String cmdTmp = RESTOREACL_CMD_1 + file.getParent().toString() + RESTOREACL_CMD_2 + acl
+ file.getFileName().toString().replaceAll("\\.", "") + RESTOREACL_CMD_3;
try... |
ccd48ee0-ef41-4bf1-b065-633a1b1d66dc | 6 | public static String fold( List valueList, final String token )
{
String lastToken = token;
while( true )
{
String foldedToken = foldImpl( valueList, lastToken );
if( foldedToken.equals( lastToken ) )
{
break;
}
else
{
lastToken = foldedToken;
}
}
if( lastToken.length() > LIBINJECTION_SQLI_MAX_TOKENS ... |
2f26ea44-ba19-4765-b1ca-0dab80cb183f | 3 | public String getTypeSignature() {
switch (typecode) {
case TC_LONG:
return "J";
case TC_FLOAT:
return "F";
case TC_DOUBLE:
return "D";
default:
return "?";
}
} |
16a1716d-29a5-4a48-bf3c-c8a00bde2706 | 4 | public Console registerShorcut() {
Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getShiftKey() && event.getNativeEvent().getAltKey()
&& event.getNativ... |
ba715a95-a95a-4227-ab1c-0b6b7f672468 | 6 | @EventHandler
public void WitchInvisibility(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Invis... |
e6fb3bd2-5525-42a9-8b65-f4379ece7355 | 8 | public boolean hasNext() {
if (matcher == null) {
return false;
}
if (delim != null || match != null) {
return true;
}
if (matcher.find()) {
if (returnDelims) {
delim = input.subSequence(lastEnd, matcher.start()).toString();
... |
a0e49d7e-8565-432f-a78f-f1fe75d06117 | 8 | @Override
public ArrayList<Chromosome<T>> update()
{
if(chromoPool.size() % 2 != 0)
{
throw new RuntimeException("Gene pool size is not dividable by 2");
}
ArrayList<Chromosome<T>> newChromoList = new ArrayList<Chromosome<T>>();
double totalF... |
31d37c46-1340-4c7b-927e-9d61bc5e0f76 | 1 | public void visit_newarray(final Instruction inst) {
final Type type = (Type) inst.operand();
if (type.isReference()) {
final int index = constants.addConstant(Constant.CLASS, type);
addOpcode(Opcode.opc_anewarray);
addShort(index);
} else {
addOpcode(Opcode.opc_newarray);
addByte(type.typeCode())... |
c0786d88-0ac4-46af-84b7-60cb5449a35b | 6 | public Gezin addOngehuwdGezin(Persoon ouder1, Persoon ouder2) {
if (ouder1 == ouder2) {
return null;
}
Calendar nu = Calendar.getInstance();
if (ouder1.isGetrouwdOp(nu) || (ouder2 != null
&& ouder2.isGetrouwdOp(nu))
|| ongehuwdGezinBestaat(oud... |
0965e76a-bfbe-468d-bc2c-b5026a6dde0c | 9 | public static void runRace() {
try {
while (!exit && !goToMainMenu && !goToPostRaceScreen && !restart) {
// If the display isn't visible (minimised), delay the game more
if (!Display.isVisible()) {
Thread.sleep(200);
}
// If the display is requested to close, exit the program
else if (Di... |
d248a202-49af-45b7-8efc-81bb4e6876ee | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
a03aeccb-6da4-47b6-9e75-4435d52782fc | 3 | public final int readShort() throws IOException {
int ch1 = readByte();
int ch2 = readByte();
if(ch1 < 0)
ch1 = BYTE_MAX + ch1;
if(ch2 < 0)
ch2 = BYTE_MAX + ch2;
if ((ch1 | ch2) < 0)
throw new EOFException();
return (ch1 << 8) + (ch2);
} |
13161d77-18db-4509-bc3b-0ff9e93a5e68 | 6 | public void testRetainAllArray() {
int element_count = 20;
int ints[] = new int[element_count];
for ( int i = 0; i < element_count; i++ ) {
ints[i] = i;
}
TIntList list = new TIntLinkedList( 20 );
for ( int i = 0; i < element_count; i++ ) {
list.a... |
0759e7c4-88d4-4cac-a0a8-40dab94731d1 | 6 | public Object getValueAt(int lin, int col) {
Object o=null;
switch (col) {
case 0 : o=lancamentos.get(lin).contaDe;
break;
case 1 : o=lancamentos.get(lin).contaPara;
break;
case 2 : o=String.format("%1$td/%1$tm/%1$tY",lancamentos.get(lin).dataIni);//.getTime();
break;
case 3 : o=String.format("... |
ddd6227f-a9ca-4034-a96f-2c74de23e8da | 0 | public String getAddress() {
return address;
} |
167ff5b9-7c15-4c17-9cef-e459b869580d | 1 | public static void saveObject(Object object, String file_name) {
try {
ObjectOutputStream oos =
new ObjectOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(file_name))));
oos.writeObject(object);
oos.close();
}
catch (IOException e) {
System.err.println("Exception writing ... |
45dc1526-c120-4170-a950-a052b479cd78 | 0 | public Iterator getSprites() {
return sprites.iterator();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.