method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cfe070ed-e747-472e-a361-f8fdc71d2b29 | 6 | public static String numberToString(Number number)
throws JSONException {
if(number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if(string.indexOf('.') > 0 && string.indexO... |
02581704-ea7e-44c8-953e-6ead5c0fce0d | 7 | @Override
public void run(CommandSender sender, String maincmd, String[] args)
{
if (sender instanceof Player && !sender.hasPermission("mobmanager.admin"))
{
sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to use /mm saveitem");
return;
}
if (!(sender instanceof Player))
{
se... |
34ab7015-8544-4269-b7a6-7839954f4023 | 1 | public void printNodeArray(ArrayList<Integer> nodes) {
System.out.println();
for (int i = 0; i < nodes.size(); i++) {
System.out.print(" " + nodes.get(i).toString() + " ");
}
System.out.println();
} |
24130557-8b6d-4b29-a5c4-f687438eed3e | 9 | public static ArrayList<Question> parseJson(String str) throws Exception
{
ArrayList<Question> qs = new ArrayList<Question>();
JSONParser parser = new JSONParser();
String[] lines = str.split("\n|\r");
for(String line : lines)
{
Question q = new Question(... |
5b6e6bfb-9e03-4e39-b2de-a98332f6e27b | 9 | public Grid extend(PointDouble values) {
double minX;
double maxX;
double minY;
double maxY;
double distance;
Grid result;
// left
if (Utils.smOrEq(values.getX(), getMinX())) {
distance = getMinX() - values.getX();
// exactly on grid point?
if (Utils.eq(distance... |
6f6634d8-10e5-4b5e-b64c-a876e953ebec | 6 | private static void addotuToFamily(HashMap<String, String> map, File f) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(f));
reader.readLine();
for(String s= reader.readLine(); s != null; s = reader.readLine())
{
String[] splits = s.split("\t");
String lastToken = ... |
6e82429d-20c7-412d-9335-053450690264 | 8 | public boolean applyChangeset(Changeset changeset) {
boolean status = true;
// First clear resources (if any)
if (changeset.triplesCleared() > 0) {
boolean status_c = executeClearResources(changeset.getCleared());
logger.info("Patch " + changeset.getId() + " CLEARED " +... |
c258b2f5-fffc-44c5-ac7d-b849cad8bd7d | 0 | public final int getColumnCount() {
return columns;
} |
09c8c8bc-c124-457b-a957-96122f83818a | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
3f062a2a-1abd-4ca7-8c9a-2cbb3f6570c8 | 8 | private String eliminateEscapes(String s) {
StringBuilder b = new StringBuilder();
boolean prevSlash = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (!prevSlash) {
if (c == '\\') {
prevSlas... |
b7b3cb4c-1bde-44bb-bf1b-afdac7a4ee7e | 0 | public String getAccountId() {
return accountId;
} |
7d7d3aed-8a19-440b-9d60-4411fe0b55a7 | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((players == null) ? 0 : players.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
} |
cf5ede6a-e39b-49d8-b88e-0846d766d1d8 | 0 | public void setEditable(boolean editable) {
frozen = !editable;
} |
84086045-2727-4d0f-afaf-e4dcb9fdf353 | 0 | public TestConfig(Map props) throws Exception {
this.props = props;
} |
c595e9e5-3df6-45a8-89f7-9f911f4ae054 | 8 | public static void main(String[] args) {
IterableBlockWorld world = new BlockWorldImpl();
IsoBlockCanvas c = new IsoBlockCanvas(world);
c.setScale(22);
c.setZScale(1.0);
int zz = 4;
int w = 10;
for (int i = -w; i <= w; i++) {
if (Math.abs(i) != w) {
for (int z = 1; z < zz; z++) {
world.add(ne... |
777323cd-dfec-43c9-bd60-acc6642f0f0d | 2 | public List<ComboBoxInterface> getComboBoxInterfaceList()
{
List<ComboBoxInterface> list = new ArrayList<ComboBoxInterface>();
try {
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM teacher");
while(rs.next())
{
list.add(getTeacherFromRS(rs));
}
rs.close();
} catch (SQLExce... |
98d57c14-98f4-48de-8e63-87a935620daa | 0 | public SearchPanel(DataAccess manager) {
super();
this.manager = manager;
initialize();
} |
bfe8b716-7c47-44b5-8ad6-a3a431eeae1e | 9 | @EventHandler
public void onEntityInteract(EntityInteractEvent event) {
Entity ent = event.getEntity();
Block block = event.getBlock();
if(ent instanceof Arrow) {
Arrow arrow = (Arrow)ent;
if(block.getType() == Material.WOOD_BUTTON) {
if(arrow.getShooter() instanceof Player) {
Player player = (Pla... |
d1263fb7-0f1f-4857-9f47-de8658e75550 | 6 | public void addParametersCost(NodeArgument[] params, double cost) {
this.costTable.put(NodeArgumentArray.getNodeArgumentArray(params), cost);
// set the min and the max
if ((cost != Double.NEGATIVE_INFINITY) && (cost != Double.POSITIVE_INFINITY)) {
if (this.minCost == null || cost ... |
fc0565da-373d-4f4a-a0d8-b27c4cb0cc65 | 1 | public StdMenuBar() {
for (MenuProvider provider : MENU_PROVIDERS) {
add(provider.createMenu());
}
} |
44818e0a-2799-43fb-9898-a16621820e4f | 6 | @Override
public boolean halt(Event lastEvent, OurSim ourSim) {
boolean halt = true;
List<Job> finishedJobsList = new LinkedList<Job>();
for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) {
if (entity instanceof Broker) {
Broker broker = (Broker) entity;
List<Jo... |
3f670cea-d05f-46c7-8c8f-bfa1e885a76e | 3 | @Override
public Iterator<Integer> iterator()
{
return new Iterator<Integer>()
{
private int mCurrent = -1;
@Override
public boolean hasNext()
{
return findNext() != -1;
}
@Override
public Integer next()
{
mCurrent = findNext();
return mCurrent;
}
private int ... |
ce0b4a2e-f413-452e-8940-043a2fd9d92d | 1 | protected void processActionEvent(ActionEvent e) {
if(actionListener != null) {
actionListener.actionPerformed(e);
}
} |
06a664b6-68dc-4cde-8997-8c842b506064 | 6 | @Override
public void run()
{
running = true;
while (running)
{
try
{
switch (functionStep)
{
case ONE:
{
long[] values = stepOneQueue.take();
s... |
5e1e41b5-bc32-4f30-b225-2e6e37ed436b | 6 | public static void updateTexture(Sprite sprite,int numero, int direction){
IntRect rect ;
if(sprite instanceof Mob) {
compteurAnimation[numero]++;
if (compteurAnimation[numero] == 40)
compteurAnimation[numero] = 0;
//System.out.println(compteurAnimati... |
c5fb3682-74d5-450d-b194-73793744b65b | 1 | public void put(int hash, Object o) {
if (size++ > threshold)
grow();
modCount++;
int slot = Math.abs(hash % buckets.length);
// /#ifdef JDK12
Bucket b = new Bucket(o, queue);
// /#else
// / Bucket b = new Bucket(o);
// /#endif
b.hash = hash;
b.next = buckets[slot];
buckets[slot] = b;
} |
40734a6d-3116-44b6-b612-6a56ddeed21c | 6 | private void addNumbers(Block[][] block) {
for (int i = 0; i < block.length; i++) {
for (int j = 0; j < block.length; j++) {
if (block[i][j] instanceof Mines) {
// Numbers of mines on that Mines Block
int index = ((Mines) block[i][j]).getNumOfMines();
for (int a = i - 1; a <= i + 1; a++) {
... |
0fee9112-b5a0-418f-809e-64edae3413d3 | 5 | public String getFormTrackArtist(int formTrackNumber) throws SQLException
{
List<Track> trackRepTracks = new LinkedList<Track>();
for (Track t : getTracks())
if (t.getFormTrackNumber() == formTrackNumber)
trackRepTracks.add(t);
Set<Groop> grpset = new TreeSet<Groop>();
g... |
028bfe66-94a9-40b2-98cf-0121509adc08 | 9 | @Override
protected int[] ParsePosition( String ToParse )
{
int Position[] = { 0, 0 };
if( ToParse.length() == 2 )
{
switch( ToParse.toUpperCase().charAt( 0 ) )
{
case('A'):
... |
cfe5d21d-8ea8-488e-9707-32831f21d691 | 3 | public String deleteRoomType(String roomType) {
Query q = em.createQuery("SELECT t from TypeEntity t");
for (Object o : q.getResultList()) {
TypeEntity p = (TypeEntity) o;
if (p.getRooms().size() == 0) {
if (p.getName().equals(roomType)) {
em... |
5761df35-3b4f-4dee-aceb-261c23e55254 | 3 | private int loadShader(String filename, int type) {
StringBuilder shaderSource = new StringBuilder();
int shaderID = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
shaderSource.append(line).append("\n");
}... |
c7bf29f1-14d2-480a-8dae-102edf225aee | 0 | public ConvertPane(AutomatonEnvironment environment, Automaton automaton) {
super(new BorderLayout());
drawer = new SelectionDrawer(automaton);
automatonPane = new AutomatonPane(drawer);
JSplitPane split = SplitPaneFactory.createSplit(environment, true, 0.6,
automatonPane, new JScrollPane(table));
automat... |
bb88b885-d0aa-4ae7-8410-63461811eac2 | 6 | private String findInFile(String className, String stateName) {
JSONParser parser = new JSONParser();
try {
//Location of sentences.json file
Object obj = parser.parse(new FileReader("resources/nlg/sentences.json"));
//Access to a sentence
JSONObject jsonObject = (JSONOb... |
fde3d71c-a2d1-4858-b1ce-a401c8bd2555 | 2 | public void showSkiPassInfo() {
if (skiPassCard == null) {
System.out.println("\nYou don't have a ski-pass card!");
} else {
System.out.println("\nSki-pass info:");
System.out.println("ID\t" + skiPassCard.getID());
System.out.println("Card type\t" + skiPas... |
64f0c23e-75d3-4239-8b31-e6724eab7a0f | 3 | @Override
public void doCommand() {
GunTower gt = new GunTower(this.position.x, this.position.y, this.player);
// Can the player allow it ?
if(player.getBank().getMoney() > gt.getBuyingPrice()) {
// we add the tower to the game
Game.getInstance().getTowerManager().addTower(gt);
if (this.play... |
333a2b52-e064-43cc-a551-6f3d9aaeccc3 | 1 | protected void setFitness() {
for(int i = 0; i < numberOfParticles; i++){
double currentfitness = objectiveFunction.CalculateFitness(position[i]);
fitness.put(i, currentfitness);
}
} |
52961ac3-b44f-4919-b85a-fbb0842141ae | 0 | public int [] getBottomLeft()
{
return bottomLeft;
} |
87991d61-e57a-4f6b-9cef-8e9c6f8a69fa | 5 | public static boolean dragChild(WidgetChild c, int slot) {
if (c == null || !c.visible() || !SlotData.validateSlot(slot))
return false;
WidgetChild dest = SlotData.getMainChild(slot);
if (c.hover() && c.getBoundingRectangle().contains(Mouse.getLocation())) {
Mouse.drag(dest.getCentralPoint(), 10, 10);
re... |
776f238c-ea8f-4fb0-893a-9db9ffec06b2 | 3 | private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stringFlavo... |
e21af05c-2bfd-4c43-a692-6b39a5eef063 | 3 | private long timeFromNodes(double alpha1, double beta1,
double alpha2, double beta2,
double pa, double pb, int nodes) {
double hg;
double p = pa*nodes + pb;
if (p>1)
p=1;
else if (p<0)
p=0;
do {
hg = hyperGamma(alpha1 , beta1 , alpha2 , beta2 ... |
48c8f393-4d2c-42be-8714-0d4aecbb9763 | 5 | @Test
public void RWRandomCarNumberTest() throws Exception {
ArrayList<UnilabsCar> in_buf = new ArrayList<UnilabsCar>();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayInputStream in;
UnilabsCar[] buf = new UnilabsCar[new Random().nextInt(50)];
Writer w = new SimpleWriter(out);
Reader r;... |
0abaca60-0d8d-4e18-9fc5-78902de87dbb | 3 | public void restart() {
IIterator iter = blockCollection.getIterator();
while (iter.hasNext()) {
iter.remove(iter.getNext());
}
for (int y = 0; y <= boardSizeY; y++) {
for (int x = 0; x <= boardSizeX - 1; x++) {
tetrisMap[x][y] = 0;
}
}
score = 0;
lines = 0;
level = 1;
linesRequiredForN... |
d9039f32-6dc3-47a3-96a6-760dbb9fca66 | 1 | public void stopSoundtrack() {
if (this.soundtrack != null) {
this.soundtrack.stop();
}
} |
d99280b9-3faf-4114-bba0-c3075bc89424 | 9 | @Override
public String process(String code) {
// filter comments, chars and strings
FilterComments fC = new FilterComments();
code = fC.process(code);
// FilterChars fCh = new FilterChars();
// code = fCh.process(code);
// FilterStrings fS = new FilterStrings();
// ... |
b7e7c3f8-0fea-4385-b361-1d15067356b9 | 8 | public void runAlgTime()
{
int numN = numNodes;
VertexPulse vi;
int di;
int ti;
int lowIterator = 0;
boolean empty;
while (Snum < numN) {
while (lowIterator < Delta) {
vi = lowLevelBuckets[lowIterator].getEntrance();
di = vi.getMaxDist();
ti = vi.getMinTime();
empty = deleteToLabe... |
18b4f21b-8505-4141-ac11-2969f8188f36 | 8 | public static Field findFreeNeighbour(Field currentField, Box box, Agent agent) {
Random rand = new Random();
ArrayList<Integer> possibleIndexes = new ArrayList<Integer>();
for (int i = 0; i < 3; i++) {
possibleIndexes.add(i);
}
while(!possibleIndexes.isEmpty()){
int index = possibleIndex... |
09faae41-a5b9-4ea7-878c-60d57d6bcff6 | 5 | public static void main(String[] args) {
// TODO code application logic here
// 4. Dadas dos cadenas S1 y S2. Eliminar en S1 todos esos caracteres que se presentan en S2. Devolver un S1 limpio con los caracteres eliminados. Cualquier carácter se elimina tanto en mayúsculas como en minúsculas.
//Por ejemplo, da... |
45a85337-6279-48c8-a4d7-c7364b166931 | 5 | public void test_25_exon_bases() {
System.out.println("Loading config file");
config = new Config("testCase", Config.DEFAULT_CONFIG_FILE);
config.loadSnpEffectPredictor();
System.out.println("Loading fasta file");
String fastaFile = "tests/testCase.fa";
String seq = GprSeq.fastaSimpleRead(fastaFile);
//... |
60f94740-66fc-485b-83f1-128d6fe47419 | 4 | public void hasBeenActivated(Editor editor) {
if (editor == this) {
Code.debug("hasBeenActivated");
EditorActionManager eam = getEditorActionManager();
eam.enableFormatActions(false);
eam.enableGenericActions(true);
eam.enableDocumentActions(true);
// Test the state of the conta... |
c11234bc-a73e-47f4-beab-a8c1cbaee513 | 2 | public static void closeEntityManager() {
EntityManager m = JPAUtil.manager.get();
if (m != null) {
EntityTransaction t = m.getTransaction();
if (t.isActive()) { // TODO
// CoreLog.getInstance()
// .getLog()
// .warn("EntityManager ... |
eef46f89-1005-414f-a1c9-b7ee837e8453 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if(msg.target()==affected)
{
if((msg.tool()!=null)
&&(CMLib.dice().rollPercentage()>... |
b79f09dd-d596-4fbd-ba9f-b745f5a0e453 | 4 | public final WaiprParser.globalstat_return globalstat() throws RecognitionException {
WaiprParser.globalstat_return retval = new WaiprParser.globalstat_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal56=null;
Token ID57=null;
CommonTree char_literal56_tree=null;
Common... |
7d18cb11-4cb5-44b7-99b4-f6fcac169626 | 8 | @Override
protected void eatCombinationTwo() {
int yellow = 0;
int red = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.YELLOW_PLANT && yellow < 1) {
it.remove();
yellow++;
}
if (pl.getType() == Plant.RED_PLANT && red < 1)... |
d5fb6f69-b3ca-479e-8ee9-d26ab1e54fd8 | 9 | public DirectObjectPointer build() {
if (bean == null && fileChannel == null && mappedByteBuffer == null) {
throw new IllegalArgumentException("One of fromBean, fromFileChannel or fromMappedByteBuffer is mandatory");
}
DirectObjectPointer pointer = null;
... |
9fcfc5fd-d12e-4836-b26d-3298c1140596 | 3 | public static HashMap<String, Integer> nGramMapper(String countFile)
throws IOException {
HashMap<String, Integer> nGramMap = new HashMap<String, Integer>();
FileReader in = new FileReader(countFile);
BufferedReader br = new BufferedReader(in);
String input;
while ((input = br.readLine()) != null) {
... |
278b5cd2-b97a-48ae-8dc7-910ff977c252 | 0 | public NeuralNet() {
inputNeurons = new LinkedList<Neuron>();
/* Create a dud output neuron for safety sake. */
outputNeuron = new Neuron(new PolynomialTerm(0));
} |
e1c72053-d30f-4bbf-badc-91fe3bd599de | 0 | protected Class getTransitionClass() {
return automata.turing.TMTransition.class;
} |
957707aa-d597-4bb0-8b61-bf6d678f74da | 0 | public void setOffline() {
lastSignal = System.currentTimeMillis()-2*Constants.NOT_ALIVE_INTERVAL*1000;
} |
b5479ee2-4b9c-4f09-99c1-b55889535669 | 2 | public Integer get(int index) {
if (index < 0 || index >= size)
throw new IndexOutOfBoundsException();
return $.getInt(address + index * SIZE_OF_INT);
} |
0dbac2c8-02d2-450b-8ecb-375481a089a4 | 1 | private boolean onkoNopeusToistaKohti(Pelihahmo h){
double toisenSuunta = normalisoi(hahmojenValinenKulma(h));
double nopeus = normalisoi(nopeudenSuunta(h));
return nopeus > toisenSuunta - Math.PI/2 && nopeus < toisenSuunta + Math.PI/2;
} |
82dc00f9-84b9-407c-99c5-e1751e1ede96 | 4 | private void doNewKompetens() {
// check so eveything is ok
if (!Validate.tfEmpty(tfBenamning)) {
if (Validate.notOverSize(tfBenamning) && Validate.notOverSize(taBeskrivning)) {
int res = newKompetensdoman();
if (res == 1) {
PanelHelper.cle... |
feb87088-6c3e-4e8f-af63-468e3631c0a5 | 2 | public void flushEditor() {
Editor editor = getEditor();
VCNTreeItem item = editor.getTreeItem();
if (item != null && !item.isDisposed()) {
item.setContent(editor.getText());
}
} |
7e5f3de3-b976-4220-8ac1-1cc56a411a52 | 5 | public boolean isAvailable() {
boolean reachable = false;
for (int i = 0; i < 10; i += 1) {
if (reachable) {
break;
}
Socket sock = new Socket();
int port = 139;
if (getType().equalsIgnoreCase("nfs")) {
port = 111;
}
try {
sock.connect(new InetSocketAddress(getIp(), port), 1000);
... |
dc455086-4e2a-4fe5-9665-aae6461f73ef | 3 | public ListNode partition2(ListNode head, int x) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
ListNode preHead1 = new ListNode(x);
ListNode preHead = preHead1;
preHead.next = head;
ListNode p = head;
ListNode preP = preHead;
while (p != null) {
if (p.va... |
127d7659-ef78-4110-bcb2-bca687882d69 | 7 | public void removeOnetimeLocals() {
StructuredBlock secondBlock = subBlocks[1];
if (secondBlock instanceof SequentialBlock)
secondBlock = ((SequentialBlock) secondBlock).subBlocks[0];
if (subBlocks[0] instanceof InstructionBlock
&& secondBlock instanceof InstructionContainer) {
InstructionBlock first = ... |
e34be3d8-5909-48ce-8642-56dc87d3912d | 4 | private void move( Wallet dest, Wallet src, Yen moveAmount) {
final Yen preAmount = dest.getTotalAmount().add( src.getTotalAmount());
// FIXME: 投入金額からお金を崩して、moveAmountちょうどの金額ができるようにする
// 安いコインから順に移動させる
Deque<Coin> coins = Queues.newArrayDeque( //
Immutabl... |
c29f11e8-7be1-4d5e-9357-636aeb9164df | 1 | public boolean equals(Object o)
{
if (!(o instanceof String))
{
return false;
}
String qText = (String) o;
return (questionText == qText);
} |
fc40429b-ba40-4b51-9433-8ccc17cc97cb | 1 | public Collection operands() {
final LinkedList v = new LinkedList();
final Iterator preds = cfg.preds(block).iterator();
while (preds.hasNext()) {
final Block pred = (Block) preds.next();
v.addFirst(operandAt(pred));
}
return v;
} |
063cabc8-ed5d-42a0-b7be-18eb78aa3441 | 1 | public String getContentType(Request request) {
String type = URLConnection.guessContentTypeFromName(request.getURI());
if (type == null) {
type = "text/html";
}
return "Content-Type: " + type;
} |
a398d7d8-078c-4a38-a5b4-d386b753ad54 | 4 | private boolean hasVisitedNeighbours(Point p){
int c = 0;
if (this.maze[p.x - 1][p.y] == false) {c++;}
if (this.maze[p.x + 1][p.y] == false) {c++;}
if (this.maze[p.x][p.y - 1] == false) {c++;}
if (this.maze[p.x][p.y + 1] == false) {c++;}
return c > 1;
} |
c206f9cc-b4b3-45b8-927b-0081b4f6b802 | 4 | public int compare(Event arg0, Event arg1) {
// the comparison is twofold: first, we sort based on the time when the event fires
// if the time is equal for two events, the event that was created earlier is defined
// to be smaller. (This approach guarantees a consistent ordering).
if(arg0.time == arg1.tim... |
e748f552-14e7-41a7-a415-519a1f6a35e0 | 2 | public static void main(String[] args) {
/*
* Commandline invoer wordt verwerkt.
* De uitvoer wordt berekend door de functie som.
*/
int n = Integer.parseInt(args[0]);
if(n < 0 || n > 65535) {
System.out.println("Invoer getal is te groot of te klein voor dit programma");
} else {
int nsom = som(... |
2df21d4e-e655-45e8-882c-00fa320b20e8 | 9 | private void deleteCommits() {
int size = commitsToDelete.size();
if (size > 0) {
// First decref all files that had been referred to by
// the now-deleted commits:
Throwable firstThrowable = null;
for(int i=0;i<size;i++) {
CommitPoint commit = commitsToDelete.get(i);
... |
9dbe79a9-e3f6-4c47-84ad-0da796f2fcd5 | 2 | private void close () {
if (handle == null)
return;
try {
handle.close();
socket.event_closed (endpoint, handle);
} catch (IOException e) {
ZError.exc (e);
socket.event_close_failed (endpoint, ZError.errno());
}
... |
e406bcbc-2dac-4d79-9f30-c52965e41480 | 2 | @Override
public double arvo() throws IllegalStateException {
if (!super.laskettavatAsetettu() || super.getTakajasen().arvo() == 0) {
throw new IllegalStateException();
}
return super.getEtujasen().arvo() / super.getTakajasen().arvo();
} |
92270e2d-07e0-4f75-a7bb-d1118cf45fbf | 5 | public void testLength1() {
Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(2) }));
Term zs = q5.oneSolution().get("Zs");
assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2... |
e21bfe94-122c-42d0-abfc-50cf2b672034 | 0 | public void setName(String name) {
Name = name;
} |
d8b58c34-111c-4876-a44d-15c31f848e60 | 8 | void compute()
{
diagonals = new Diagonal( 0, this, 0 );
diagonals.p = new Path( 0, 0, PathOperation.nothing, 0 );
Diagonal current = diagonals;
best = diagonals;
d = 1;
int run = 0;
int N = (A.length>B.length)?A.length:B.length;
while ( d < N )
... |
2b29116b-2b60-4a6d-bb64-ac46ea488d3b | 6 | public static void showFrame () {
/* 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://download.or... |
7442cbf7-29db-41fe-b6b5-6d16c4e0e64a | 7 | public double[] distributionForInstance(Instance instance) throws Exception {
double[] probs;
if (m_isLeaf && m_hasConstr) { //leaf
//leaf: use majoraty class or constructor model
probs = modelDistributionForInstance(instance);
} else {
if (m_isLeaf && !m_hasConstr)
{
p... |
7a7a05a7-2636-4353-8c93-1d50e0a46adf | 2 | public void EnvoyeTousClients(String message) {
synchronized (outputStreams) {
for (Enumeration<DataOutputStream> e = outputStreams.elements(); e
.hasMoreElements();) {
DataOutputStream outStream = (DataOutputStream) e.nextElement();
try {
outStream.writeUTF(message);
} catch (IOException ioe... |
3e45ec80-ae83-4e36-9f25-b18c5cd1e607 | 8 | public void printAuswertungPDF() {
if (table.getSelectedRowCount() == 0)
return;
List<EinzelWettkampf> lewk = new Vector<EinzelWettkampf>();
List<MannschaftsWettkampf> lmwk = new Vector<MannschaftsWettkampf>();
for (int i : table.getSelectedRows()) {
Wettkampf w = (Wettkampf) table.getValueAt(i, -1);
i... |
57912dea-d25d-4429-b886-74dc9ee086cd | 3 | public void setMenos(TMenos node)
{
if(this._menos_ != null)
{
this._menos_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
a956178c-a5c6-4556-89fb-8eb02a7911ee | 9 | public void atualizarWidgets(ImagemDeTabuleiro estado) {
int valor = 0;
int colunaLimite;
boolean simboloDaVez;
simboloDaVez = atorJogador.informarSimboloDaVez();
if(simboloDaVez){
daVez.setIcon(azulPreenchida);
} else {
daVez.setIcon(marromPreenchida);
}
for (int linha = 0; ... |
c8f3393b-ca53-46b6-a7f4-97b346022f09 | 4 | private void areaSolve()
{
Log.log("AreaSolve <Start>");
collectAreas(false);
for (Area area : mAreas)
{
if (area.isToRemove()) continue;
if (area.isEmpty())
{
openTiles(area.getTiles());
mChanged = true;
}
else if (area.isFull())
{
markTiles(area.getTiles());
mChanged = true;... |
6ddca0ff-7db1-4185-a7fc-1bfb0033ea1d | 6 | public void run(){
int clientCount = -1;
while(true){
Iterator<ServerThread> it = connections.iterator();
while(it.hasNext()){
ServerThread conn = it.next();
if(!conn.isAlive()){
it.remove();
continue;
... |
614eda02-c24e-44f9-acc9-5976eee4f5a9 | 7 | public ExtDecimal sqrt(int scale) {
if (type == Type.NUMBER) {
if (this.compareTo(ExtDecimal.ZERO) >= 0) {
double dblval = this.doubleValue();
double dblguess = Math.sqrt(dblval);
//ExtDecimal factor = ExtDecimal.valueOf(1 / (2 * dblguess));
... |
cefcff3b-dda3-407d-9fb6-5a404a74d5d0 | 1 | public static void forceRepaintAndInvalidate() {
for (AppWindow window : AppWindow.getAllWindows()) {
window.invalidate(window.getRootPane());
}
} |
fdca12d6-eb6e-4a68-ac5d-dae29fe5f7b1 | 5 | public void updatePages() throws InvalidMenuException{
int totalPages = pages.size();
List<Page> sorted = new ArrayList<Page>();
for(int i = 0; i < totalPages; i++){
sorted.add(Page.NULL_PAGE);
}
boolean[] missing = new boolean[totalPages];
for(int i = 0; i < missing.length; i++){
missing[i] = true;
... |
54ed0763-61e6-47a2-9526-ceee912709cd | 4 | private boolean grabWavBlock () {
// Decide how to handle the WAV data
// 16 bit LE
if ((audioInputStream.getFormat().isBigEndian()==false)&&(audioInputStream.getFormat().getSampleSizeInBits()==16)) {
return grabWavBlock16LE (audioInputStream);
}
// 8 bit LE
else if ((audioInputStream.getFor... |
08f77310-76de-4718-a239-c10b8bd3b925 | 1 | public StopWords(String file1,String file2)
{
try {
reader=new BufferedReader(new InputStreamReader(new FileInputStream(new File(file1))));
writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(file2))));
list=new ArrayList<String>();
} catch (FileNotFoundException e) {
e.print... |
55302855-3f7b-4f4b-baac-dc5af3809286 | 7 | @Override
public State transition(TransitionContext context)
{
if(context.isEof())
{
context.startToken();
context.emit(Kind.EOF);
return this;
}
if(context.isDigit())
{
context.startToken();
context.pushChar();
return NumberState.instance();
}
if(context.isWhitespace())
{
return... |
6feb79fd-c9cb-4708-94fb-c6f42d24aec8 | 3 | public void turnRight(double degrees)
{
if(crawlOff)
heading = heading - degrees;
else
{
double interval = 5.0;
if(degrees < 0)
interval = -interval;
double temp = heading - degrees;
while(Math.abs(heading - temp... |
f6513d2f-3c27-46e3-894b-53fb218a9732 | 5 | public static int maxSequence(Rack r, int rack_size, int drawn, boolean forceBetter){
//Replace the drawn card with each value in rack
int prev_score = r.getLUSLength();
int max_pos = 0, max_score = 0;
for (int i=0; i<rack_size; i++){
int swapped = r.swap(drawn, i);
int temp_score = r.getLUSLength();
i... |
3bd39701-ba4a-417f-a148-55c5793ba3a6 | 2 | public static void main(String[] args) throws InterruptedException {
Thread.currentThread().setName("Startup");
GWCAConnection gwcaConnection = null;
try {
LOG.info("The \"Java GWCAConstants\" (version {}) is starting", Version.getVersion());
addShutdownHook();
... |
d8390a71-a6df-446e-b198-88c3c8a38a0d | 4 | public void grille(){
for(int y = 0; y<env.taille_envi;y++){
for(int x = 0; x<env.taille_envi;x++){
if(env.grille[x][y]!=null){
Graphics g = agent[x][y].getGraphics();
if(((Bonhomme)env.grille[x][y]).type)
g.setColor(Color.RED);
else
g.setColor(Color.GREEN... |
c0861efa-d169-46ae-913e-55bdadb2ab8d | 0 | public boolean insert(PageId pageNo, int frameNo) {
// Instantiate a new entry
BufHTEntry entry = new BufHTEntry();
// Set entry properties
// NOTE: this should be part of the constructor or through a setter method
entry.pageNo.pid = pageNo.pid;
entry.frameNo = frameNo;
... |
8ac1a82d-d768-4012-8217-3de93982e6a8 | 5 | public Double calculateActivation(Double input) {
if (!objectIsSetUp)
throw new InvalidParameterException(
"No Setup method has been called! You need to call a Setup Method to set the Objects Properties.");
switch(myAlgorithm){
case Logistic: return Logistic(input);
case BoundedIdentity: return Saturate... |
25ab2319-4fd3-445d-89a6-7037a3cffaac | 4 | public void act()
{
if (!direction)
{
redShadow.mirrorHorizontally();
}
redShadow = new GreenfootImage("Ninja//ninjaAbilityR//redShadow.png");
if (direction)
{
setRotation(30);
}
else
{
setRotation(150);
... |
7bd23610-3ffa-4194-a35f-4bae09de494f | 1 | @Override
public void update(Observable o, Object arg) {
if(o instanceof Interes)
{
System.out.println("Nuevo Interes: "+((Interes)o).getInteres());
}
//arg creo que contiene el valor que cambio
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.