method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c151f0f4-3e84-47a1-b328-1caaa6d7cf64 | 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 Organization)) {
return false;
}
Organization other = (Organization) object;
if ((this.id == null && other.id !... |
b6274a96-93ea-4340-8f16-a55e0c48b583 | 3 | private void getFriendlyNeighbours(City city, VertexSet result){
VertexSet set = getNeighbourhood(city);
for(City c : set){
// ist eine Stadt noch nicht im Result Set und gehrt zum
// gleichen Owner, wird sie hinzugefgt und mit getFriendlyNeighbours
// aufgerufen
if(c.getOwner() == ci... |
3c00355f-ee17-45e2-beaf-a70100dad071 | 6 | private void acceptCurrentView(){
// TODO :: this can be reduced
if(addEntityStateObj)
temporary.acceptView();
if(removeEntityStateObj)
temporary.acceptView();
if(addEntityState)
temporary.acceptView();
if(removeEntityState)
tempora... |
57a70366-20c2-4820-a73c-758f6b158bd6 | 1 | public void jump() {
if (jumped == false) {
speedY = JUMPSPEED;
jumped = true;
}
} |
e8503852-4dea-4608-a152-0f4d523d3081 | 1 | private List<Position> getPositions(Position start, Direction dir, int length) {
final List<Position> positions = new ArrayList<Position>();
positions.add(start);
for (int i = 1; i <= length; i++) {
Position newPos = positions.get(positions.size() - 1);
positions.add(dir.newPosition(newPos));
}
return... |
1dfb4d83-6e1e-4676-b426-1090c269b652 | 6 | public static int[] innerUnion(int[] firstArr, int[] secondArr) {
if (firstArr == null || secondArr == null) {
return new int[]{};
}
int[] _firstArr = firstArr.clone();
int[] _secondArr = secondArr.clone();
Arrays.sort(_firstArr);
Arrays.sort(_secondArr);
... |
5f56444c-1667-4074-a9e4-f69720d40f38 | 7 | 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 fe... |
e7774257-108b-42d7-a19b-3bab67258d9a | 2 | public void run() {
while(true) {
try {
msgArea.append(reader.readLine()+"\n");
}catch(Exception e){
e.printStackTrace();
}
}
} |
cb9ef294-7876-4466-ba0b-a18a09eb78a9 | 1 | public List<Student> findStudents(Activity activity) {
List<Student> students = new ArrayList<Student>();
Set<Student> studentsActivity = activity.getStudents();
for (Student s : studentsActivity) {
students.add(s);
}
return students;
} |
ccd6b5e1-83f8-4593-ac4b-392eb39159e6 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
71b0950e-739f-4dc8-971b-b7526f536b2c | 5 | public static BufferedImage getImage(String fileName) {
BufferedImage i = null;
String path = "../images/";
File f = null;
try {
f = new File(ResourceLoader.class.getResource(path + fileName)
.getPath());
} catch (NullPointerException e) {
Console.log("file + " + fileName + " is not there", in.ERRO... |
aea2bcc0-7e96-4540-ba67-32c4fb6fdda0 | 8 | private void printRecommendedKeyword(int threshold) {
int i;
double thres = (double) threshold / (double) 100;
boolean flag = false;
Iterator it = tagword.iterator();
while (it.hasNext()) {
String result = it.next().toString();
if (antecedent.containsKey(r... |
08aa9767-6839-4af4-917e-6ffae3dfea25 | 3 | public static ArrayList<Planet> forDcalcDist(PlanetWars pw){
// Tested
ArrayList<Planet> asw = new ArrayList<Planet>(2);
asw.add(null);
asw.add(null);
// Find the best couple source/destination relying on Dcalculation + distance (our heurisctic function)
int heurisctic = -1024;
for (Planet s : pw.MyPlane... |
2f93edd5-9dd2-40c7-b9f6-d044a194a361 | 3 | public void dfs(DirectedNode root) {
Stack<DirectedNode> stack = new Stack<DirectedNode>();
stack.push(root);
root.visited = true;
while (!stack.isEmpty()) {
DirectedNode node = stack.pop();
for (DirectedNode nodes : node.edgeNodes) {
if (!nodes.vi... |
04d5514c-1e7e-420e-93fd-87904a70443c | 2 | private boolean jj_3_51() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_52()) {
jj_scanpos = xsp;
if (jj_3_53()) return true;
}
return false;
} |
eea7feca-cbf8-4fcd-8b6f-2e90de5b63fb | 2 | public void checkAces(){
for (int i=0;i<hand.size();i++)
if (hand.get(i).getRank().equals("Ace"))
{
ace = true;
aceindex=i;
}
} |
cde4c433-36d8-4904-84fa-69a5fb07f994 | 6 | private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
if(nombreproveedoresField.getText().trim().isEmpty() || telefonoproveedoresField.getText().trim().isEmpty() || laboratorioperteneceField.getText().trim().isEmpty())
{
JO... |
a0272ebb-f24d-4edd-87f2-99d1902103e1 | 5 | public static int getPinNumber(String pinName) throws InvalidGPIOException{
int pinNumber = -1;
// See if we have the JSON for this Pin
JSONObject pinJSON = DTO.findDetails(pinName);
if (pinJSON != null && pinJSON.containsKey("gpio")) {
try {
pinNumber = Integer.parseInt((String) pinJSON.get("gpio"));
... |
7505704b-4040-4040-8782-d56ff809697e | 9 | public static boolean SPUpdateState(Firebase fb, Game game, Move move) {
Map<String, Object> data = new LinkedHashMap<String, Object>();
String player = SPStringifySide(SPGetOpposingSide(move.getSide()));
if (player != null) { data.put(kGameStateCurrentPlayer, player); }
else { return ... |
f4aafdd8-4564-48a4-8d28-0038d9009127 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IngredientData other = (IngredientData) obj;
if (ingredientLocation == null) {
if (other.ingredientLocation != null)
return false;
} else if (!ingre... |
33e92ab8-33a5-4415-992d-26861463db49 | 3 | void shiftLow() throws IOException {
int LowHi = (int) (Low >>> 32);
if (LowHi != 0 || Low < 0xFF000000L) {
position += cacheSize;
int temp = _cache;
do {
Stream.write(temp + LowHi);
temp = 0xFF;
}
while (--cache... |
31521699-1853-4185-b940-171e397df908 | 7 | public void func_76672_e()
{
blockRefCount = 0;
tickRefCount = 0;
for (int i = 0; i < 16; i++)
{
for (int j = 0; j < 16; j++)
{
for (int k = 0; k < 16; k++)
{
int l = getExtBlockID(i, j, k);
... |
433db733-849b-4aad-82e4-d9facb2d9b50 | 1 | public void testSetIntoIntervalEx_Object_Chronology3() throws Exception {
MutableInterval m = new MutableInterval(-1000L, 1000L);
try {
StringConverter.INSTANCE.setInto(m, "P1Y/", null);
fail();
} catch (IllegalArgumentException ex) {}
} |
35141ea1-04b8-4b68-91d9-8b281552643e | 4 | static public OutputChannels fromInt(int code)
{
switch (code)
{
case LEFT_CHANNEL:
return LEFT;
case RIGHT_CHANNEL:
return RIGHT;
case BOTH_CHANNELS:
return BOTH;
case DOWNMIX_CHANNELS:
return DOWNMIX;
default:
throw new IllegalArgumentException("Invalid channel code: "+code);
}
} |
76eebf3a-d79f-4def-a5b2-082d1abbd750 | 1 | public static void restartApplication(){
board.dispose();
Arbiter.restart();
hexxThread = new Thread(new Runnable() {
@Override
public void run() {
state = new State();
ui = new HaxagonUI();
board = new Board(5, state, ui);
synchronized (state) {
try {
state.wait();
... |
cd23d60c-1bfb-4966-bd3f-bfa4423965ca | 3 | @Override
public void run() {
// if sheep is somehow null (it died/is unloaded)?
if ( sheep == null ) {
SheepFeed.debug(" Sheep is null ");
return;
}
// reset color if not natural
if ( !this.sheepFeedPlugin.config.isRegrowColor(this.sheep.getColor()) ) {
this.sheep.setColor(DyeColor.WHITE);
}
//... |
d732b82b-adef-4bc0-948b-fefcff4cbf34 | 7 | public void actionPerformed(ActionEvent evt) {
//Offline
if(evt.getSource() == offlineMI) {
Boot.setOffline(!Boot.isOffline());
}
//Hide
else if(evt.getSource() == hideAppManagerMI) {
this.setVisible(false);
}
//Exit
else if(evt... |
03599a6d-ffd4-47ea-b5eb-762d5e77f0e2 | 9 | public static void main(String[] args) throws Exception {
String fileName = args[0];
String outputFileName = args[1];
int outputHeight = RainbowUtils.getInt(args, 2, OUTPUT_HEIGHT);
int outputWidth = RainbowUtils.getInt(args, 3, OUTPUT_WIDTH);
System.out.println("Input: " + fileName);
System.out.println(... |
639bb551-b307-4f2f-98bc-832d35e55fea | 8 | static String toCSVString(String s) {
if (s == null)
return "";
StringBuilder sb = new StringBuilder(s.length()+1);
sb.append('\'');
int len = s.length();
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
switch(c) {
case '... |
1195c662-ff98-4bee-8038-19808558a748 | 0 | protected void createGroup(GroupObject groupObject) {
openMainPage();
goToGroupListPage();
initGroupCreation();
fillGroupForm(groupObject);
submitGroupCreation();
returnToGroupListPage();
} |
de74316a-eb5a-41f1-a9f8-12f94230c03e | 9 | public void writeToExcel(String fileName, List<GongHangDetail> details,String cardNo,String userName,String oper, String printDate){
ExcelUtils excelUtils = new ExcelUtils();
try{
//一共的数据行数
int totalDataRows = details.size();
//每页数据行数
int prePageNum = 50;
/... |
6b595cbf-1015-4eee-bc2f-8c5207e846fb | 5 | public static void handleEvent(int eventId)
{
if(eventId == 1)
{
System.out.println("Exit high score menu selected");
Main.highScoreMenu.setVisible(false);
Main.highScoreMenu.setEnabled(false);
Main.highScoreMenu.setFocusable(false);
Main.mainFrame.remove(Main.highScoreMenu);
Main.main... |
43ae37b1-ade0-44d8-ac5d-7ce8f286c760 | 6 | public void commit() {
method.clearCode();
final CodeGenerator codegen = new CodeGenerator(method);
visit(codegen);
final Label endLabel = method.newLabel();
method.addLabel(endLabel);
// Add all the handlers back in the same order we got them.
// This ensures that the correct catch clause will be call... |
eb6640ea-4395-412e-83fb-db74d36e6ee5 | 6 | public static void fileSet(Matrix M){//not ready
try {
FileInputStream fileStream = new FileInputStream("test.txt");
Scanner scanner = new Scanner(fileStream);
ArrayList<String> lines = new ArrayList();
int t=0;
int s=0;
int i=0;
... |
6c093e54-8bfd-47b7-b719-91ec92b489c8 | 8 | public void run(){
if ( typeTest == StressTestMain.CHAIN_TYPE){
if ( user.connect() )
setStatus("user #: " + numOfThread + " \n\t Status: connected\n");
else
setStatus("user #: " + numOfThread + " \n\t Status: connection error\n");
}
String login = "Test" + numOfThread;
try {
user.regi... |
7d96dfc0-8b23-4fa0-a4fd-8caac8f6ad28 | 2 | protected void executePerform() {
try {
StringTokenizer st = new StringTokenizer(perform,"\n");
int count = st.countTokens();
for (int i = 0; i < count; i++)
parseCmd(st.nextToken());
} catch (Exception exc) {
exc.printStackTrace();
}
} |
d0a9dc2e-217e-4fd8-afae-6883b7773a5e | 2 | @SuppressWarnings("unused")
private static void parseSiblings(XMLParserStAX parser) throws ParsingException
{
Element e;
while((e = parser.next()) != null)
{
printElement(e);
if(e.hasChildren())
{
parser.down();
parseSiblings(parser);
parser.up();
}
}
} |
c20fd318-6261-4361-a2a4-a66fceab4088 | 1 | public void buildLoadMenu() {
mainMenu.setPositionOverTime(mainMenu.getX(), (Theater.get().getScreen().displayWidth / 4) - (mainMenu.getFullWidth() / 2), mainMenu.getY(), mainMenu.getY(), 0.1f);
mainMenu.showCursor(false);
if(Save.get().getSaves() == null) {
loadMenu = new PlainText(false, 0f, false);
lo... |
d9974587-d112-4e2b-a0b9-d2f6acd34f9f | 9 | protected synchronized void setProgress(int a) {
if (totalBytes > 0) {
sentBytes += a;
//
// progBar.setValue(sentBytes);
//
// //labelBytesSent.setText("Bytes Sent: " + sentBytes + "/" + totalBytes);
//
// if ((sentBytes * 100) / totalBytes > percentComplete) {
// ... |
a4814826-66ea-4c59-9d89-ceeb8a49a244 | 0 | public static Set<String> seenTags() {
return trackedTags.keySet();
} |
de0f7aec-1c08-4468-9559-7119ba004edc | 0 | @Override
public String[] getConfiguredContentTypes( ISourceViewer sourceViewer ) {
return new String[] {
IDocument.DEFAULT_CONTENT_TYPE,
CoffeescriptPartitionScanner.COMMENT,
};
} |
ea811312-be47-43f2-894a-0838f3fade31 | 6 | private List<Literal> extractLiteralList(String endElement) throws XMLStreamException, ParserException {
List<Literal> literals = new ArrayList<Literal>();
while (reader.hasNext()) {
int event = reader.next();
switch (event) {
case XMLStreamConstants.START_ELEMENT:
currTag = getXmlTag(reader.getLocalNa... |
306cd220-88b0-43e6-8b8e-7131d1bd0568 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Params params = (Params) o;
if (verbose != params.verbose) return false;
if (!dstFile.equals(params.dstFile)) return fa... |
e6496e71-2603-416c-b431-5a31ec27b4bb | 3 | public boolean call(AddressHolder addresses) {
targetAddress = selectAddressFromHolder(addresses,
consumer.getMetadata());
try {
consumer.startCall(targetAddress);
} catch (InterruptedException e) {
return false;
}
if (consumer.getObject(targetAddress) != null) {
try {
clazz = Class.forName(c... |
4db2b90b-dc28-4fbf-8f5d-ce72b3713d42 | 7 | protected void bounceInteractivelyFrom(AdvancedPhysicDrawnObject d,
DoublePoint collisionpoint, double bounciness,
double frictionmodifier)
{
// TODO: It seems like the speed lost isn't equal to the speed gained
// Calculates the direction of the collision
double oppdir = d.getCollisionForceDirection(... |
287f5778-d7bd-469e-9650-eb378f56af06 | 1 | public double getCoeff(int choiceLeft){
assert(choiceLeft>0);
if (choiceLeft>=100)
return coefficients[99];
else
return coefficients[choiceLeft];
} |
617b7c01-2dd5-4822-a2b4-c9c36abd7a26 | 1 | final void invalidate() {
if ((access & LEAF_IN) == LEAF_IN) {
return;
}
value = NULL;
} |
d4a3bfb9-8d7b-4c2f-9f9f-3d7d4fbf7614 | 1 | @Override
protected Iterable<? extends Item> dependentItems() {
return getLabels();
} |
b85c70a8-f94b-495f-a29f-54b2707f94c3 | 7 | private void refreshChannel() {
synchronized (this) {
OutputStream stream = new OutputStream();
stream.writeString(ownerDisplayName);
String ownerName = Utils.formatPlayerNameForDisplay(owner);
stream.writeByte(getOwnerDisplayName().equals(ownerName) ? 0 : 1);
if (!getOwnerDisplayName().equals(ownerNam... |
5097ff8b-82bd-4835-8467-c5767912245f | 6 | public static void jWaitCraft(String wnd, int timeout) {
int cur = 0;
while (true) {
if (cur > timeout)
break;
if (UI.instance.make_window != null)
if ((UI.instance.make_window.is_ready) &&
(UI.instance.make_window.craft_nam... |
60c5fe40-76ab-48b8-a348-509b7eb88b84 | 7 | protected String createCacheKey(Object args[], Method method, Cache cacheAn) {
String cacheKey = null;
// 获取缓存KEY的前缀:cacheKeyPrefix
String cacheKeyPrefix = cacheAn.cacheKeyPrefix();
// 若cacheKeyPrefix不为空,将对该缓存做相应操作否则直接执行方法
if (!Strings.isEmpty(cacheKeyPrefix)) {
// 获取该方法欲读取的缓存的 KEY——将拼接方法注解中的cacheKeyPrefi... |
691529d0-a94d-4c46-81de-538e038e2c57 | 7 | public Method findMethod(Class<?> theCForce, String name, int nArgs)
throws NoSuchMethodException {
for (Method m : theCForce.getDeclaredMethods()) {
if (m.getName().equals(name)
&& m.getParameterTypes().length == nArgs) {
return m;
}
if (m.getName().equals(name)
&& m.getParameterTypes().len... |
fd06d96c-f6a5-4fc9-ac33-6678f05c890a | 7 | @Override
public void action(String text) {
for (int i = 0; i < paramArrays.length; i++)
if (Utils.speechMatchesParams(text, paramArrays[i])) {
switch (i) {
case 0:
Speak.say("Please say the location");
ArrayList<String> possibles = speechRecognition();
boolean good = false;
for (Strin... |
61900062-ff8e-4767-ad3e-8e99df54cf16 | 0 | public void setScore(Score score) {
this.score = score;
} |
a3335fc9-496a-4a41-ad64-ed2c89b0eac7 | 6 | public void doStuffs()
{
btmr--;
x = x + (int) Math.round(xSpeed);
y = grav.y;
grav.moveFall(20);
if(x < 0){ x = 0; xSpeed = 0; }
if(x > 780){ x = 782; xSpeed = 0;}
if(xSpeed < 0 && !moving) xSpeed = xSpeed + 0.1;
if(xSpeed > 0 && !moving) xSpeed = xSpeed - 0.1;
} |
79a71479-e18c-4eec-aca9-04fa45eb13c7 | 8 | public void destroy() {
setAction(null);
MouseListener[] ml = getMouseListeners();
if (ml != null) {
for (MouseListener i : ml)
removeMouseListener(i);
}
ActionListener[] al = getActionListeners();
if (al != null) {
for (ActionListener i : al)
removeActionListener(i);
}
ItemListener[] il =... |
00f1e34b-0fe8-4ae5-9942-f037fbf3acd6 | 5 | public int[] next()
{
if (repeat-- > 0) {
shuffle(p, random);
return p;
}
else
return null;
} |
c44b26c9-421b-4d98-883d-e197b4d1e27b | 9 | protected static String[] splitParameterFromRemainingOptions(
String cliString) {
String[] paramSplit = new String[2];
cliString = cliString.trim();
if (cliString.startsWith("\"") || cliString.startsWith("'")) {
int endQuoteIndex = cliString.indexOf(cliString.charAt(0), 1... |
2d1b6cea-4693-4c59-8819-e5f8777f08a7 | 4 | public boolean isLowerHessenberg(){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(i>(j+1) && this.matrix[i][j]!=0.0D)test = false;
}
}
return test;
} |
3075fc01-035c-4e0a-8428-9d53f84131b5 | 2 | public void display() {
int cellID = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.print(cells[cellID].getState().getTextualIcon());
++cellID;
}
System.out.println();
}
} |
4269fa4f-b9ba-487d-940d-af69f8b5b989 | 0 | public void addPeer(TrackedPeer peer) {
this.peers.put(peer.getHexPeerId(), peer);
} |
b38e116c-0c7d-4833-8a51-d3238bd2dae1 | 6 | public void pokemonExpTypes() {
if (expType == 1) {// Erratic Exp
expReq = (int) (double) ((GameFile.pokemonLevels[0]
* GameFile.pokemonLevels[0] * GameFile.pokemonLevels[0] * (100 - GameFile.pokemonLevels[0])) / 50);
} else if (expType == 2) {// Fast Exp
expReq = (int) (double) ((4 * GameFile.pokemonLev... |
d4f4f3f3-f904-4680-9ba5-858c96e584f6 | 8 | private void initialize() {
frmStudentPortal = new JFrame();
frmStudentPortal.setBackground(new Color(240, 240, 240));
frmStudentPortal.setTitle("Student Portal");
frmStudentPortal.setBounds(100, 100, 450, 300);
frmStudentPortal.getContentPane().setLayout(null);
frmStudentPortal.setSize(640, 480);
JLabe... |
4f90d085-95f1-4a6a-9434-dd45561ba268 | 8 | @Override
public final void run(Task task)
throws Exception {
final InputRelationList relList = task.getData()
.require(InputRelationList.class);
final IFPNode fpRoot = task.getData()
.require(IFPNode.class);
for(final IInputRelation rel: relList... |
f09d29d8-0096-4ec7-9c72-206f7154ad69 | 8 | public boolean isPub(MOB mob, Room room)
{
for(int m=0;m<room.numInhabitants();m++)
{
final MOB M=room.fetchInhabitant(m);
if((M!=null)&&(M!=mob))
{
if(CMLib.flags().canBeSeenBy(M,mob))
{
final ShopKeeper SK=CMLib.coffeeShops().getShopKeeper(M);
if(SK!=null)
{
for(final Iterat... |
5ba177f8-ad27-4d18-80f2-29fc8484b37e | 2 | public String toString() {
return familyName == null || familyName.length() == 0 ? "UNKNOWN" : familyName;
} |
4e919f91-ec89-43a5-a363-d72a77a6f963 | 0 | public void setLocalNumber(String localNumber) {
this.localNumber.set(localNumber);
} |
a8016e26-01a4-407d-91d2-addc6ff0bf3b | 1 | public String getLocation() {
try {
clientSocket.Escribir("GET_LOC\n");
serverAnswer = clientSocket.Leer();
} catch(IOException e) {
}
System.out.println(serverAnswer);
return serverAnswer.replace("124 OK", "");
} |
4ebfc077-d311-4a25-9706-63a23fbe0728 | 7 | public int lengthOfLongestSubstring(String s) {
if (s == null || s.length() == 0) {
return 0;
}
int max = 1;
int currentStart = 0;
int currentLength = 0;
HashMap<Character, Integer> sequence = new HashMap<Character, Integer>();
for (int i = 0; i < s.... |
2ab7f54e-da75-40a7-8427-a1f0a468f2c0 | 8 | public void ReceiveXML() {
try {
// TODO Auto-generated method stub
Properties env = new Properties( );
// ... specify the JNDI properties specific to the vendor
InitialContext jndi;
jndi = new InitialContext(env);
QueueConnectionFactory queueC... |
cc066c46-f533-408e-bc08-617946d0bcc2 | 3 | public static int calculateColour(int myColour, int parentColour)
{
int z = (myColour ^ parentColour);
int l = (int)Math.log(Math.max(myColour, parentColour))+1;
int i = 0;
for (; i < l; i++)
{
if ((z & (1 << i)) > 0)
{
System.out.println("index " + i);
break;
}
}
int result = i*2;
if ... |
f4b77a95-5e78-4fe0-a121-103ac049f352 | 0 | @Override
public String toString() {
return nom ;
} |
a411019b-bc96-4533-bf4e-ca45b02566a5 | 7 | private ArrayList<Iteration> secantMethod(ProjectInput input) {
ArrayList<Iteration> iterations = new ArrayList<Iteration>();
if (input.getIteration().isEnabled() && input.getThreshold().isEnabled()) {
iterations = SecantComputation.secantBoth(input.getPolynomial(), input.getX0(), input.getX1(),
input.ge... |
b7ec190f-9b3c-4f8e-a32e-ca75c5bedfb0 | 7 | private double neigh_value(double x_cur, double x_min, double x_max, double r) {
double ranval, zvalue, new_value;
double work3, work2 = 0, work1 = 0;
double x_range = x_max - x_min;
// ------------ generate a standard normal random variate (zvalue) -------------------
// perturb cur... |
4d267029-9ecf-4738-ab5b-69b923d12b7a | 3 | public String toString() throws JSONException {
if (this.string == null) {
int c;
int length = 0;
char chars[] = new char[this.length];
for (int at = 0; at < this.length; at += characterSize(c)) {
c = this.characterAt(at);
if (c < 0... |
a47ab106-8596-4f90-b0e3-ea7fd7b3d9e3 | 5 | public void cull()
{
if( !active( GET, XXX ) )
return;
if( playing() && toLoop )
toPlay = true;
if( rawDataStream )
toPlay = true;
active( SET, false );
if( channel != null )
channel.close();
channel = null;
} |
19971d0a-638b-4ca6-ba55-c1b1649fbb7c | 6 | Function_0(Dictionary d) {
// initiate, domain and range
super(d);
Vector s = (Vector) d.getObject("Size");
// setup size array, each entry represents the number of samples for
// each input dimension.
size = new int[s.size()];
for (int i = 0; i < s.size(); i++) ... |
509ec683-defd-417a-9764-9e118e1d019a | 7 | public void uimsg(String msg, Object... args) {
if (msg == "pop") {
is_ready = true;
final int xoff = 50;
if (inputs != null) {
for (Widget w : inputs)
w.unlink();
for (Widget w : outputs)
w.unlink();
}
inputs = new LinkedList<Widget>();
outputs = new LinkedList<Widget>();
int i... |
82b223a2-2a46-45a7-be1d-fc76cceac6de | 7 | private String[][] setPlayerShips(String playerName) {
Scanner input = new Scanner(System.in);
int iLocation = 0;
int jLocation = 0;
Location locationObject = new Location();
String[][] listOfSpots = locationObject.makeStringListOfSpots();
String... |
6e95b2fa-3229-4558-9c5d-604df2247113 | 6 | @Override
public void destroy(VirtualMachine virtualMachine) throws Exception {
if (status(virtualMachine).equals(VirtualMachineStatus.RUNNING)) {
stop(virtualMachine);
}
try {
String snapshotLocation = getSnapshotLocation(virtualMachine, "current");
File snapshotFile = new File(snapshotLocation);
... |
e8ea70b5-6225-41e0-bed4-563bbbaca1c4 | 3 | public static void init()
{
textures = new ArrayList<BufferedImage>();
BLANK = 0;
BufferedImage img = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
img.setRGB(0, 0, Color.black.getRGB());
img.setRGB(1, 0, Color.yellow.getRGB());
img.setRGB(0, 1, Color.yellow.getRGB());
img.setRGB(1, 1, Color.bl... |
55cb9dd8-bc89-483a-bf85-3fb01c902beb | 0 | public Map<String, Object> valuesWithColumnNames(ValueVisitor defaultVisitor) {
return values(2, defaultVisitor);
} |
87517cbc-770d-45c9-9353-be88ba4368cc | 7 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!plugin.getConfigHandler().isEatingEnabled()) return;
if (!event.hasItem()) return;
Player player = event.getPlayer();
ItemStack item = player.getItemInHand();
// Players can eat food when they are sneaking.
if (player.is... |
810bbc8a-c2b9-4bcc-8ed5-a440359934e2 | 9 | public static Tile getTile(type type){
/*To add a new tile to the game, add it's constructor to this switch statement with a unique ENUM and unique charactor
*
*/
if(tiles.get(type) == null){
switch(type){
case FLOOR: tiles.put(type, new FloorTile(
TileMultiton.class.getResource("/tile/openDoor.png... |
5cca5f4e-dd68-42be-8e11-2664ab90e1fa | 1 | public void testParseMutablePeriod_simple() {
MutablePeriod expect = new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8);
assertEquals(expect, f.parseMutablePeriod("P1Y2M3W4DT5H6M7.008S"));
try {
f.parseMutablePeriod("ABC");
fail();
} catch (IllegalArgumentExceptio... |
bc648783-5856-4ae4-8963-06468764ca9b | 7 | protected void doTestCycAccess12(CycAccess cycAccess) {
long startMilliseconds = System.currentTimeMillis();
try {
//cycAccess.traceOn();
String utf8String = "ABCdef";
assertEquals(utf8String,
cycAccess.converseString("(identity \"" + utf8String + "\")"));
InputStreamRea... |
480142d5-639f-4266-b181-f6cf9d6bbe89 | 1 | private Node getPrevious(Node node)
{
Edge e = edgeTo.get(node);
if (node.equals(e.getFromNode()))
{
return e.getToNode();
} else
{
return e.getFromNode();
}
} |
faefac0d-1f8f-4ace-a535-3a7de7b9614d | 2 | private void rejectClient(int clientId, String address, int port) {
logger.fine("Client " + clientId + " was refused");
synchronized(CONNECTION_LOCK) {
try {
sendPacket(Packet.createConnectionRefusedPacket(), new ClientInfo(clientId, address, port, InetAddress.getByName(address)));
} catch (UnknownHostExc... |
96003b18-c17a-4bac-a04f-d2eb444f8124 | 2 | public Matrix transpose() {
Matrix A = new Matrix(N, M);
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
A.data[j][i] = data[i][j];
}
}
return A;
} |
12d2d73b-8f0f-4228-a56e-f4684b96f95a | 7 | public void deParse(AlterTable alterTable) {
buffer.append("ALTER TABLE ");
buffer.append(alterTable.getTable().getWholeTableName());
boolean first = true;
for (AlterOperation alterOperation : alterTable.getAlterOperations()) {
if (!first) {
buffer.append(", "... |
a514f9d0-7405-4d17-a890-b11128f7d2db | 7 | public final double getPrice(final int itemId) {
if (priceCache.containsKey(itemId)) {
return priceCache.get(itemId);
}
final MapleData item = getItemData(itemId);
if (item == null) {
return -1;
}
double pEntry = 0.0;
MapleData pData = item... |
14d2c3d7-a52c-4c46-97bc-ba5214abca17 | 3 | private void borrowBook(String bookTitle) {
for (Book currBook : list) {
if (currBook.getTitle().equals(bookTitle)) {
if (currBook.isBorrowed())
System.out.println("Sorry, this book is already borrowed.");
else {
currBook.rented();
System.out.println("You successfully borrowed "
+ cur... |
61d6e925-5997-4b1b-9480-342feec0e1e0 | 6 | public void testAdd() {
RunArray<Font> runArray = new RunArray<Font>();
// First add fontC for characters 200-259
assertEquals(0, runArray.addRun(200, 60, fontC));
// Verify font
for (int i = 200; i < 260; i++) {
assertEquals(fontC, runArray.atRun(i));
}
// Add fontA for characters 0-99
assertEqual... |
11c8e124-c845-4f2c-91f7-cac290bae549 | 7 | public int checkPath(Locations start, Locations end, boolean attacking) {
int row = start.getRow();
int column = start.getColumn();
ArrayList<Locations> list = board[row][column].getPath(start, end);
ColorTeam team = board[row][column].getColorTeam();
for (Locations x : list) ... |
a04a48c8-6b8b-4990-a531-c44723da1fcc | 8 | private static int longestChain(String[] words) {
if (words == null || words.length == 0) {
return 0;
}
Map<Integer, Set<String>> lenWordsMap = new HashMap<Integer, Set<String>>();
int longestChain = 0;
int curLen = 0;
for (int i = 0; i < words.length; i++) {
int len = words[i].length();
curLen = M... |
b6ea19a7-e24c-4d3c-af6e-f41c0cba357a | 5 | private int handleWord(LexicalAnalyser analyser, int beginIndex)
throws AnalyseException {
String content = analyser.getSentence();
for (int index = beginIndex; index < content.length(); index++) {
char c = content.charAt(index);
if (!WordTable.isDigit(c) && !WordTable.isLetter(c)) {
int endIndex = ind... |
8665ea0a-2883-4c5d-a0a0-fadb01735c6c | 4 | public void DropArrows(int EnemyX, int EnemyY) {
if(playerEquipment[playerWeapon] != 4214 && playerEquipmentN[playerArrows] != 0)
if (ItemHandler.itemAmount(playerEquipment[playerArrows], EnemyX, EnemyY) == 0) {
ItemHandler.addItem(playerEquipment[playerArrows], EnemyX, EnemyY, 1, playerId, false);
} e... |
5a232ef9-c5ca-4791-9c42-d19f7b94a7ec | 9 | public static String packOptionsToString(Hashtable<String, GameOption> ohash, boolean hideEmptyStringOpts)
throws ClassCastException
{
if ((ohash == null) || ohash.size() == 0)
return "-";
StringBuffer sb = new StringBuffer();
boolean hadAny = false;
for (Enumeration<String> e = ohash.keys(); e.hasMoreEl... |
f9b19f36-01eb-4696-94c0-912aa224c489 | 7 | public int moveDown(boolean findChange) {
int total = 0;
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 4; x++) {
if (next.grid[x][y] != 0 && next.grid[x][y] == next.grid[x][y+1]) {
next.grid[x][y] *= 2;
next.grid[x][y+1] = 0;
... |
6f37cc75-e78f-4de0-92a2-0a58c9276c68 | 9 | void close() throws PersistitException {
if (_nestedDepth > 0 && !_commitCompleted && !_rollbackCompleted) {
final TransactionStatus ts = _transactionStatus;
if (ts != null && ts.getTs() == _startTimestamp && !_commitCompleted && !_rollbackCompleted) {
rollback();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.