method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
95ffc9a7-c1dd-4d73-b54d-91d90763d241 | 0 | public ChartPanel BarChart(){
CategoryDataset dataset = getDataSet();
JFreeChart chart = ChartFactory.createBarChart3D(
"水果", // 图表标题
"水果种类", // 目录轴的显示标签
"数量", // 数值轴的显示标签
dataset, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平... |
d74175eb-06a4-4053-8023-fa8b25624f8c | 6 | public void injectLyrics(Path audioFilePath) {
AudioFile audioFile;
try {
audioFile = AudioFileIO.read(audioFilePath.toFile());
Tag audioFileTag = audioFile.getTag();
String lyrics = lyricWiki.getLyrics(audioFileTag.getFirst(FieldKey.ARTIST),
audioFileTag.getFirst(FieldKey.TITLE)).trim();
if(lyri... |
d16eb487-1e05-4d01-8c66-725063c9990f | 5 | private ArithmeticResult funcCall(Block codeBlock) throws IOException, SyntaxFormatException {
if (checkCurrentType(TokenType.CALL)) {
moveToNextToken();
String funcName = lexer.getCurrentToken().getIdentifierName();
assertAndMoveNext(TokenType.IDENTIRIER);
ArrayList<ArithmeticResult> argumentList = new A... |
5afe1880-9978-4278-9d47-578cbfc73128 | 2 | @SuppressWarnings("unchecked")
public final K[] decode(final String crypt) {
ArrayList<K> plain = new ArrayList<K>();
String code = "";
for (final Character c : crypt.toCharArray()) {
code += c;
K symbol = this.codes.get(code);
if (symbol!=null) {
plain.add(symbol);
code = "";
}
}
return ... |
72c313ad-cd15-4a54-a76d-dd9427f72bda | 2 | public static void main(String[] args) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
for (int i = 0; i < 10; i++) {
final int no = i;
Runnable runnable = new Runnable() {
@Override
public void run() {
... |
6d322b27-db06-4f5b-9c9a-580956affd83 | 8 | @Override
public synchronized K remove(Object arg0)
{
if (!map.containsKey(arg0))
return null;
final LinkedEntry<T, K> p = map.remove(arg0);
if (map.size() == 0)
{
head = null;
tail = null;
return p.second;
}
LinkedEntry<T, K> pn = p.next;
while ((pn != null) && (tail != pn))
{
pn.index... |
2029348e-ade8-441b-bf33-1274323bcf29 | 5 | public String reverseVowels(String s) {
if(s==null || s.isEmpty()) return s;
StringBuilder sb=new StringBuilder(s);
List<Integer> list=new ArrayList<>();
for(int i=0;i<sb.length();++i){
if("aeiouAEIOU".contains(""+sb.charAt(i))){
list.add(i);
}
... |
7e212fad-746f-4d45-af9a-575469c8276e | 9 | private boolean synchronizeSockets() {
boolean changed = false;
List<ConnectorTag> newSocketTags = new ArrayList<ConnectorTag>();
for (ConnectorTag tag : socketTags) {
if (tag.getLabel() != null) {
this.remove(tag.getLabel().getJComponent());
}
}
for (int i = 0; i < getBlock().getNumSockets(); i++) ... |
7a1008ad-2b86-4b66-9f69-57e8d1da3958 | 4 | public boolean setPlayerTurn(PlayerTurn turn) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setPlayerTurn() BEGIN");
}
m_playerTurn = turn;
if (test || m_test) {
System.out.println("Game :: setPlayerTurn() END");
}
... |
77668833-0c32-4af1-af93-24c95b69a5be | 0 | public int hashCode() {
return super.hashCode() ^ myInputToRead.hashCode()
^ myStringToPop.hashCode() ^ myStringToPush.hashCode();
} |
f1ec9c00-f854-4d38-84cf-e8eea2cbff53 | 8 | public void createTower(int id, Player.PlayerType playerType, TowerTypes towerType, Point position) {
Tower tower = null;
switch(towerType){
case ATTACKTOWER:
tower = new AttackTower(id, TowerTypes.ATTACKTOWER.cost, position, playerType);
break;
case SUPPORTTOWER :
tower = new SupportTower(... |
f7762fff-fd39-4e38-840f-3d8bd7fcdc0b | 7 | public static boolean isMonospaced(FontMetrics fm) {
Font font = fm.getFont();
String mono = "Monospaced";
String family = "family";
Map<TextAttribute, ?> attributes = font.getAttributes();
if (attributes.containsValue(mono)) {
return true;
}
Set<TextAttribute> keySet = attributes.keySet();
for (Text... |
38c61339-652a-493a-be5a-6e8ee12b6a90 | 8 | public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate = val.getClass();
... |
656b4d93-1c53-4bb1-abc7-1ae403f1b9e3 | 7 | public void add(SystemObject[] objects) throws ConfigurationChangeException {
if(checkChangePermit()) {
// wenn die Menge bereits aktiviert oder freigegeben wurde, dann darf nichts mehr geändert werden, es sei denn
// die Referenzierungsart ist "Gerichtete Assoziation", dann darf in der in Bearbeitung befindlic... |
2e8173c2-148a-4279-85af-49f0f01c4a09 | 4 | @Override
public boolean equals(Object obj)//test each conditions work well
{
//boolean equals = false;
if(this.getClass()==obj.getClass())//determine whether the type is same or not.
{
if(this.seat.length ==((SeatChart)obj).seat.length )
{// because after determining, we can use cast here(we know it ... |
ee9f27ad-d57d-435f-972f-366ab0f9295e | 7 | protected void initializeCommandTypeInfo()
{
super.initializeCommandTypeInfo();
Map mm7ArgumentTypeArrayByCommandTypeMap = super.getArgumentTypeArrayByCommandTypeMap();
Map mm7ArgumentTypeDisplayInfoArrayByCommandTypeMap = super.getArgumentTypeDisplayInfoArrayByCommandTypeMap();
... |
784a1b5c-bc55-4a9a-8eb1-aea68f81e6f2 | 2 | private void populateBirdsComboBox() {
birdsJComboBox.removeAllItems();
if(!birds.isEmpty()) {
for(int i = 0; i < birds.size(); i++) {
birdsJComboBox.addItem(birds.get(i).getName());
}
}
} |
814749e5-80b4-43b5-8b03-130d9a2d5540 | 5 | private Preferences init() {
try {
List<String> langs = Utils.getResourceListing(Preferences.class.getClassLoader(), "/lang/");
langs.remove("/langs/languages.json");
if(!langs.contains("/lang/" + language + ".json")) {
String last = this.language;
for(String lang : langs)
if(lang.startsWith("... |
f905dcae-5f5c-4e10-b09e-980e194c1fc0 | 4 | public String deletePoints(String ligne){
int i;
StringBuilder sb = new StringBuilder();
for(i=0;i<ligne.length();i++){
if(ligne.charAt(i) == '.'){
while(i+1<ligne.length() && ligne.charAt(i+1) == '.')
i++;
}
else
sb.append(ligne.charAt(i));
}
return sb.toString();
} |
e00c6ee4-db9f-45e8-a333-f890a404a9c2 | 4 | private static int[] getEachMonoCharWidth(FontMetrics fm, String value) {
if (fm == null || value == null) {
return null;
}
int cnCharWidth = fm.charWidth('米');
int enCharWidth = fm.charWidth('M');
int length = value.length();
int[] result = new int[length];
int oneByteCharCodePoint = 0x7F;
for (int ... |
33c846fa-6493-4b5b-b515-6d640591823b | 4 | public void getWheelGraph(mxAnalysisGraph aGraph, int numVertices)
{
if (numVertices < 4)
{
throw new IllegalArgumentException();
}
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
for (int i = 0; i < numVertices; i++)
{
... |
ba9e0e9c-c29b-49f0-a55b-023080c2bed5 | 3 | private Object evaluateCellFormula(final XSSFWorkbook workbook, final Cell cell) {
FormulaEvaluator evaluator = workbook.getCreationHelper()
.createFormulaEvaluator();
CellValue cellValue = evaluator.evaluate(cell);
Object result = null;
if (cellValue.getCe... |
e6876960-a9eb-4fc4-832f-55b82ff4e18a | 9 | private boolean actualizarUsuario(Usuario u, String codigo, String nombre, String clave, String cargo) {
if (u.getCodigo().equals("1")) {
JOptionPane.showMessageDialog(this, "El código y cargo del usuario\nespecial 1(UNO) no se modificarán", "Administrador principal", JOptionPane.INFORMATION_MESSAGE... |
b1428835-5111-4c0b-90b9-f4863c2cca39 | 3 | public void randDnaSeqGetBaseTest(int numTests, int numTestsPerSeq, int lenMask, long seed) {
Random rand = new Random(seed);
for( int t = 0; t < numTests; t++ ) {
String seq = "";
int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length
seq = randSeq(len, rand); // Create a random se... |
6dc94a3b-0a08-4bd6-b6ba-50e97ad80394 | 1 | public boolean EliminarProducto(Producto p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
aff662a6-7388-4f34-8763-ff1eedb4198b | 3 | public void close()
{
try {
//
for(Device d : devices)
d.close();
//
pool.shutdownNow();
//
running=false;
server.close();
//
device_monitor.interrupt();
device_monitor.join();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTr... |
d3d0e086-0d53-48af-925a-f8244e6785bc | 9 | private JButton getJButtonListar() {
if (jButtonListar == null) {
jButtonListar = new JButton();
jButtonListar.setBounds(new Rectangle(105, 330, 106, 31));
jButtonListar.setText("Listar");
jButtonListar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.... |
a3f909a5-64dd-4fdb-b78e-c0c70dd44a7c | 8 | private Slot getSlot(String name, int index, int accessType)
{
Slot slot;
// Query last access cache and check that it was not deleted.
lastAccessCheck:
{
slot = lastAccess;
if (name != null) {
if (name != slot.name)
break la... |
fab1d3a7-ff0c-474b-880a-b3cfa7bbd6db | 9 | public MidiThread (){
File midiFile = new File(file_path); // Instantiates a File object
try {
// Create a new Sequencer Object with the Midi File
Sequence sequence = MidiSystem.getSequence(midiFile);
midiSequencer = MidiSystem.getSequencer();
midiSequencer.open();
... |
dd0d6a58-e11b-430d-9d36-c3bc39ce5378 | 3 | public void createShapeList(ShapeList sl, ImageMap imagemap)
throws Exception {
sl.clear();
Hashtable<String, ImageMap> maps = imagemap.getImagemaps();
addShapeList(sl, imagemap.getAreas());
// sl.set_mapName(imagemap.getName());
if (maps != null && maps.size() > 0) {
for (ImageMap map : maps.values()... |
ae9f0f5d-8661-4710-aee8-541c4734f92b | 5 | private void checkRoyalFlush() {
int suit = hand[0].getSuit();
for (int i = 0; i < 5; i++) {
Card card = hand[i];
if (card.getSuit() != suit) {
break;
}
if (card.getValue() == (13 - i)) {
if (i == 4 && card.getValue() == 10) {
myEvaluation[0] = 10;
myEvaluation[1] = 1;
myEvaluatio... |
66c8bcc4-75e1-4c72-ae5b-3020a36fbb08 | 1 | public PlanGolden(JSONObject help) throws FatalError {
super("Golden");
try {
this.medicine = help.getInt("Medizin");
} catch (JSONException r) {
}
} |
f7d40a20-6f6e-4c2a-a20a-1269bf6f12b8 | 9 | public static int digits(int numval)
{
if (numval < 10) return 1;
if (numval < 100) return 2;
if (numval < 1000) return 3;
if (numval < 10000) return 4;
if (numval < 100000) return 5;
if (numval < 1000000) return 6;
if (numval < 10000000) return 7;
if (numval < 100000000) return 8;
if (numval < 10000... |
0f2d707a-ac6d-4b22-acd7-67dea3519ed8 | 8 | @Override
MessageExoType getMessageExoType(String arrow) {
if (arrow.contains(">")) {
return MessageExoType.FROM_LEFT;
}
if (arrow.contains("<")) {
return MessageExoType.TO_LEFT;
}
if (arrow.startsWith("/") || arrow.startsWith("[/") || arrow.startsWith("\\") || arrow.startsWith("[\\")) {
return Mess... |
cbfc5ebd-0bca-4626-843c-ba69edf98b13 | 0 | public void setAlgorithmParameters(AlgorithmParametersType value) {
this.algorithmParameters = value;
} |
3cfb5900-3b37-4c1a-8ea9-b5e1a946195f | 9 | protected void renameItem(final TreeItem item) {
boolean showBorder = true;
final TreeEditor editor = new TreeEditor(tree);
final Composite composite = new Composite(tree, SWT.NONE);
final Text text = new Text(composite, SWT.NONE);
final int inset = showBorder ? 1 : 0;
// NONO for syms and dirs
if (item.... |
14b91f88-64e0-4956-b01e-4a47365d7548 | 5 | @Override
public byte[] read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) {
setupBuffer(null);
int pos = 0;
while(pos < length) {
try {
pos += in.read(value, pos, length - pos);
} catch (SocketTimeoutException ste) {
if(!t... |
740590c2-d4d1-4a09-bb95-1dd4a754e913 | 5 | public String longestPalindrome(String s) {
if (s.isEmpty()) {
return null;
}
if (s.length() == 1) {
return s;
}
String longest = s.substring(0, 1);
for (int i = 0; i < s.length(); i++) {
// test [i]
String tmp = helper(s, i, i);
... |
9bd2fb29-316c-417a-83af-5c10bd411555 | 7 | @Override
public StatusType getInput(Object object) {
StatusType status = StatusType.PLAYING;
do {
try {
this.display(); //displays the display method from this class
//get the input command entered by user
String input = this.getCommand()... |
669d4ec3-082d-4c47-b1ca-87aef4bc8e85 | 6 | private boolean wagonHasToStop()
{
if(stoppingMarker == 850 && getY() == 550)
{
return true;
}
else if(stoppingMarker == 750 && getY() == 620)
{
return true;
}
else if (stoppingMarker == 650 && getY() == 690)
{
retur... |
cb48313d-35d2-45b6-a9e1-968a72974b53 | 1 | public void run() {
try {
InputStream is = csocket.getInputStream();
OutputStream os = csocket.getOutputStream();
String ip = csocket.getInetAddress().getHostAddress();
InputStreamHandler_ass ish = new InputStreamHandler_ass(is, os,
list, csocket.getInetAddress().getHostAddress(), this);
ish.start... |
fe15d73c-ea65-4db4-802f-8771517ab06b | 8 | public ByteBuffer getBuffer(String filePath){
ByteBuffer buffer = fileMaps.get(filePath);
if(buffer == null){
File requestedFile = new File(filePath);
if(requestedFile != null && requestedFile.exists()){
FileInputStream fileInput = null;
FileChannel fileChannel = null;
try{
... |
3df5e399-a30d-4092-a647-c878f6a080b3 | 0 | @Override
public void drawGraphForm(FrameBuffer buffer, Camera camera) {
manGraphForm.refresh(camera);
manGraphForm.drawGraphForm(buffer);
} |
31d95275-8259-47a9-abb0-443947ad8711 | 8 | public Expr evaluate(IEvaluationContext context, Expr[] args)
throws ExprException {
assertArgCount(args, 4);
Expr ens = evalArg(context, args[0]);
if (!isNumber(ens))
return ExprError.VALUE;
int nums = ((ExprNumber) ens).intValue();
if (nums < 0)
... |
71df82d7-1e8f-4c1a-807c-ee0bc4e844a9 | 0 | public void restart (){
this.log.setVisible(false);
this.setVisible(false);
getContentPane().removeAll();
this.board=new Board();
black=new Cpu(Board.BLACK,board);
turnChanger = new TurnChanger(new Player(Board.WHITE,board),black);
this.log=new LogWindow();
showBoard(true);
this.log.setVisible(true);
... |
15680691-4b63-48e4-be52-f32d762cc36c | 4 | private Rectangle computeCaretRect(int selRow, ST selType) {
Rectangle rect;
FontMetrics fm = painter.getFontMetrics(painter.getFont());
Insets i = painter.getInsets();
int gw = fm.getMaxAdvance(), gh = fm.getHeight();
if (selType == ST.RECT) {
rect = new Rectangle(1 + i.left + col * gw, // Po... |
1d473aaa-f635-4992-9e37-9b3351a7b6c2 | 3 | private void calculateWordStatistics(TreeMap<String, String> descriptions2,
TreeMap<String, Integer> wordStats) {
for (String line : descriptions2.values()) {
String reformatted = Database.simplifyText(line);
String[] words = reformatted.split(" ");
for (String word : words) {
if (wordStats.containsKe... |
953bcaa9-e60a-4dcb-acc5-21dfa41e280f | 8 | public void freeResources() {
if (stockImages != null) {
for (int i = 0; i < stockImages.length; ++i) {
final Image image = stockImages[i];
if (image != null) image.dispose();
}
stockImages = null;
}
if (iconCache != null) {
for (Enumeration it = iconCache.elements(); it.hasMoreElements(); ) {... |
19c8cfbf-8e4a-4440-9134-41aea29f54b5 | 9 | public static Stella_Object getTokenText(Cons options) {
if (!Stella.insideWithTokenizerP()) {
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
Stella.signalTranslationError();
if (!(Stella.su... |
e2a70011-a51f-4dbb-8574-8ccbbced0375 | 7 | public void outHeapMin(ArrayList<Pair> priorityQueue) {
if (size(priorityQueue) > 3) {
int childIndex = 3;
Pair bottom = bottom(priorityQueue);
Pair grandChild2 = null;
Pair grandChild3 = null;
Pair grandChild4 = null;
if (size(priorityQueue) > 4) {
grandChild2 = priorityQueue.get(4);
if ... |
d545931d-2835-4ec5-879e-46f452bad8bb | 8 | * @throws ConfigurationChangeException Falls das Objekt nicht vervollständigt werden konnte (Mengen und Datensätze konnten nicht hinzugefügt werden).
*/
private void completeImportObject(ImportObject importObject) throws ConfigurationChangeException {
// Eigenschafts-Objekt des zu importierenden Objekts
final Sy... |
cf3d3fbb-0244-45d1-ad6d-9c259b094cc5 | 0 | public static void main(String[] args) {
int i = 1234567890;
float f = i;
System.out.println(i - (int) f); // -46
} |
831b122e-2075-4b20-90b5-3bff2aa6b973 | 4 | protected Player getPlayer(Grid grid, int playerNr, Position pos) {
if (grid == null || pos == null || playerNr <= 0 || playerNr > getMaxNumberOfPlayers())
throw new IllegalArgumentException("The given arguments are invalid!");
return new Player(grid, playerNr, pos);
} |
d119a5ef-9127-40e1-84d5-13146567645f | 5 | boolean headerUpdateToolTip (int x) {
String tooltip = headerGetToolTip (x);
if (tooltip == null || tooltip.length () == 0) return false;
if (tooltip.equals (toolTipLabel.getText ())) return true;
toolTipLabel.setText (tooltip);
CTableColumn column = getOrderedColumns () [computeColumnIntersect (x, 0)];
toolTipS... |
096e148c-10fb-42d6-bb9a-8a2a5a392b8c | 8 | private String getStackTrace() {
try {
// force an exception so you can inspect the stack trace
throw new ErrorReport("Error trace:");
} catch (ErrorReport e) { // catch the exception
// record the original stack trace
StackTraceElement[] ste = e.getStackTrace();
// copy only the relevant entries
... |
62878c79-d802-4bbd-8d6b-decc21ed17f1 | 4 | public final TLParser.powExpr_return powExpr() throws RecognitionException {
TLParser.powExpr_return retval = new TLParser.powExpr_return();
retval.start = input.LT(1);
Object root_0 = null;
Token char_literal127=null;
TLParser.unaryExpr_return unaryExpr126 = null;
TLP... |
d007c77e-7c6e-4eb1-b9ee-eb764ed7d9c4 | 2 | public void populate(){
int e = 0;
for(int i=0;i<rand.nextInt(30)+1;i++){
e = rand.nextInt(EntityType.values().length-1);
while(e==6){
e = rand.nextInt(EntityType.values().length-1);
}
ents.add(new Entity(EntityType.values()[e],this));
... |
6c4852d3-4020-4707-ad60-70baab6b0c62 | 0 | public static void main(String[] args) {
Map<CmpPoint, Integer> m = new HashMap<CmpPoint, Integer>();
CmpPoint p = new CmpPoint(0,2);
m.put(new CmpPoint(1,1), 1);
m.put(new CmpPoint(0, 2), 2);
m.put(new CmpPoint(2, 0), 3);
System.out.println(m.get(p));
} |
66529ffd-3ee6-4d7b-b0d5-0819c47abbb2 | 3 | private DialogMessage(int icon)
{
switch(icon)
{
case 0: messageImage = new ImageIcon(this.getClass().getResource("/Resources/DialogPane/Tie.png"));
break;
case 1: messageImage = new ImageIcon(this.getClass().getResource("/Resources/DialogPane/PlayerOne.png")... |
115c24e3-b83b-4fb2-8d82-47b64c747ade | 2 | public Expression negate() {
if (getOperatorIndex() == LOG_NOT_OP) {
if (subExpressions != null)
return subExpressions[0];
else
return new NopOperator(Type.tBoolean);
}
return super.negate();
} |
3be46955-7382-427f-a6ab-b0434724497c | 8 | public Map<String, String> spaceParser(String[] argv) {
if( argv.length == 0){
info.printUsage("");
}
Map<String, String> map = new HashMap<String, String>();
// String[] entry;
int i = 0;
String myParam = null;
String myValue = null;
if //(Ar... |
f26f581f-a4fe-448f-bffc-513a872fe397 | 4 | public boolean getHeaderInfo() {
if (domain == null || domain.isEmpty())
return false;
try {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(domain);
CloseableHttpResponse response = httpclient.execute(httpGet);
Header[] headers = response.getAllHeaders();... |
949ac404-0eb3-4658-ac01-c712c002c9b1 | 3 | public void mouseClicked(Point p){
if(rect.contains(p) && visible){
for(GuiComponent c: components){
c.mouseClicked(p);
}
}
} |
4d7975b0-3c66-4c97-984c-3e77d4a43850 | 3 | public boolean hasAbbArg() {
String s = peek();
if(s.isEmpty()) {
return false;
} else {
return s.length() == 2 && s.charAt(0) == '-' && Character.isLetter(s.charAt(1));
}
} |
9d64dc90-6bee-4e83-a599-272d50a135eb | 7 | private void releaseServiceWithoutCheck(BeanContextChild child,
BCSSChild bcssChild, Object requestor, Object service,
boolean callRevokedListener) {
if (bcssChild.serviceRecords == null
|| bcssChild.serviceRecords.isEmpty()) {
return;
}
sync... |
45233c83-2358-4da9-9154-97b9184586d7 | 4 | @Override
public void objectReceived(Object o) {
NetMessage n;
try {
n = NetMessage.parseFrom((byte[])o);
System.out.println(n.getType().toString() + " message received");
switch (n.getType()) {
case AUTHENTICATION:
authenticate(n);
break;
case REPLY:
acknowledge(n);
break;
cas... |
a726ef3f-5e7b-4500-9135-dc8caa44230c | 4 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.cignore + " (player)");
return;
}
Proxied... |
b6f9b369-bf11-4923-9e43-106fbfa367f1 | 6 | private String getRule() {
String rule = "";
switch (cmbAlgorithme.getSelectedIndex()) {
case 0:
rule = "23/3";
break;
case 1:
rule = "23/36";
break;
case 2: // Random
Random rnd = new R... |
36a13af6-c298-4381-9121-f9269c117cd7 | 0 | public void setValue(String value) {
this.value = value;
} |
19b84cac-3c6a-4774-b0b9-2519516b6a11 | 0 | public String getAxisName(int index) {
return axes.get(index).getName();
} |
3c5a3c0a-8e1b-4725-9f02-ab75e5430b69 | 8 | @Override
public int overlap(DnaSequence seq1, DnaSequence seq2) {
// Initialize
bestScore = Integer.MAX_VALUE;
bestOffset = 0;
rotator = new SequenceRotator(seq1);
// Rotating right
int lenRight = seq2.length() - minOverlap + 1;
int lenLeft = seq1.length() - minOverlap + 1;
int len = Math.max(lenRigh... |
e087b5ab-407b-434a-8dd7-e81b6c073471 | 5 | private void getGeoInfo(String geo) {
StringBuffer value= new StringBuffer();
for(char c:geo.toCharArray()){
if(c>45&&c<58){
value.append(c);
}
if(c==44){
if(value.length()>0){
latitude=Double.parseDouble(value.toString());
value.delete(0, value.length());
}
}
}
longitude=Doubl... |
84979662-a783-45da-be5a-68918702f64a | 9 | public ParseResult parse(RSyntaxDocument doc, String style) {
Element root = doc.getDefaultRootElement();
int lineCount = root.getElementCount();
if (taskPattern==null ||
style==null || SyntaxConstants.SYNTAX_STYLE_NONE.equals(style)){
result.clearNotices();
result.setParsedLines(0, lineCount-1);
r... |
19d64b76-539d-4149-8b49-13d11edbd2c3 | 6 | public void Asociar()
{
String[] ingles = new String[6];
String[] espaniol = new String[6];
int contadorIngles = 0;
int contadorEspaniol = 0;
String[] elemento = palabras.split(",");
int contador1 = 1;
contador = 0;
int n = elemento.length;
int i = 0;
//Creas las litas de palabras en espaniol e ing... |
9d0a1749-87d4-407a-a423-ec17fd5e5517 | 4 | @Override
public boolean isValid(Location loc) {
if (loc instanceof AdvancedLocation) {
switch (((AdvancedLocation) loc).getLayer()) {
case ActorLevel:
return super.isValid(loc);
case FloorLevel:
return this.mapGrid.isValid(... |
4d70137e-448d-4fdc-aaf7-e1caf1fcc11a | 3 | public static AWSCredentials loadKeys() throws IOException{
InputStream propertiesIS = TransferManager.class.getResourceAsStream(SAMPLES_PROPERTIES_NAME);
if(propertiesIS == null) {
throw new RuntimeException("Property file does not exist");
}
Properties properties = new Properties();
pr... |
e92a8143-ef9e-41b0-864a-9e81a982e03f | 2 | @Override
public void handleNAckMessages(NackBox nackBox) {
while (nackBox.hasNext()) {
Message m = nackBox.next();
if (m instanceof PackEvent) {
PackEvent msg = (PackEvent) m;
System.out
.println("-------------NACK arrive------------------");
System.out.println("Conteúdo: " + msg.toString())... |
253cb32f-1e6a-4d20-aae0-05fb61970f18 | 0 | public static void main(String[] args) throws Exception {
String inFile = args[0]; // input .properties file
String outFile = args[1]; // output .properties file
Map props = FileUtil.loadProperties(inFile);
TestConfig test = new TestConfig(props);
test.doTest();
FileUtil.saveProp... |
788d5e22-9be7-4b42-873f-b1f8b73bf7e4 | 9 | private List<List<String>> filter(List<String[]> lines) throws FileNotFoundException, IOException {
Supplier<List<String>> stoplistSupplier = getStoplistSupplier();
Set<String> stopList = new HashSet<>(stoplistSupplier.get());
POSTagger posTagger = getPosTagger();
Lemmatizer lemmatizer = getLemmatizer();
Pre... |
20d09b29-810f-4426-bad4-78254fd9e7f2 | 2 | @Override
public boolean decideDraw(int turn) {
double drawVote = 0;
for (int i=0; i < cylons.size(); i++){
if (cylons.get(i).fromDiscardForReal(game, rack))
drawVote += weights.get(i);
else
drawVote -= weights.get(i);
}
return drawVote > 0;
} |
7b9012b5-8e17-4c91-9ab3-8066e10406c5 | 4 | public void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = sc... |
6185f8a5-012d-42ae-9f21-cd88b5cbcf75 | 8 | protected boolean verifySignature(Object sig) throws IllegalStateException {
if (publicKey == null) {
throw new IllegalStateException();
}
// byte[] S = decodeSignature(sig);
byte[] S = (byte[]) sig;
// 1. If the length of the signature S is not k octets, output 'signature
//... |
da1ea1ea-7d20-497c-a25e-4674b6740395 | 9 | public String toString(InternalPortalUrl portalUrl) {
final String serverName = ((PortalUrlImpl)portalUrl).getServerName();
final Matcher serverNameMatcher = this.serverNamePattern.matcher(serverName);
if (!serverNameMatcher.matches()) {
throw new IllegalArgumentException("C... |
a4591ec7-4efe-47e7-a039-4f9b24ec2472 | 5 | public static int getRandomFleeceColor(Random var0) {
int var1 = var0.nextInt(100);
return var1 < 5?15:(var1 < 10?7:(var1 < 15?8:(var1 < 18?12:(var0.nextInt(500) == 0?6:0))));
} |
69fe0be2-2fb3-4c6a-a959-2ff8d89c1ebe | 4 | private static void simplexe() throws MatrixException {
//Exercice préparation exam
double dataA1[][] = {{1, 0, 0, 2, 3}, {0, 2, 0, 4, 0}, {2, 1, 2, 0, 2}};
double datab1[][] = {{6}, {8}, {18}};
double dataX1[][] = {{6, 4, 1, 0, 0}};
double contraintes1[][] = {{3, 1, 4, ... |
8007ab9f-81bb-4997-bc81-8b816bcc28a9 | 7 | public void addPeers(Object peers) throws UnknownHostException {
if (peers instanceof List) {
List peersList = (List) peers;
for (Object elem : peersList) {
Map peerMap = (Map) elem;
ByteBuffer addressByteBuffer = (ByteBuffer) peerMap.get(ByteBuffer.wrap(... |
2fe8d78c-0c30-432b-af3a-0781cc5bcbd0 | 6 | public int numberOfLiveNeighboursFor(Cell cell) {
List<Cell> neighbours = new ArrayList<Cell>();
for(int offsetY = -1; offsetY <= 1; offsetY++)
for(int offsetX = -1; offsetX <= 1; offsetX++)
if(!(offsetX == 0 && offsetY == 0))
if(isValidPosition((cell.y +... |
749f7866-abc7-4c9a-b8aa-8c2e38a4596d | 9 | int determineFileType(String filename) {
String ext = filename.substring(filename.lastIndexOf('.') + 1);
if (ext.equalsIgnoreCase("bmp")) {
return showBMPDialog();
}
if (ext.equalsIgnoreCase("gif"))
return SWT.IMAGE_GIF;
if (ext.equalsIgnoreCase("ico"))
return SWT.IMAGE_ICO;
if (ext.equalsIgnoreCas... |
e08201af-a745-497e-996d-59291a3dad3a | 1 | private void set(final int local, final Object type) {
maxLocals = Math.max(maxLocals, local);
while (local >= locals.size()) {
locals.add(Opcodes.TOP);
}
locals.set(local, type);
} |
09bc5226-9a9c-4f2c-8935-9efff067794a | 4 | public Object[] getAllElements()
{
final int cs = currSize;
Object[] retArray = new Object[cs];
if(cs < bufSize)
{
for(int i = 0; i < cs; i++)
retArray[i] = bufferArray[i];
}
else
{
int j = 0;
for(int i = rwPointer; i < bufSize; i++)
retArray[j++] = bufferArray[i];
for(int i = 0; i <... |
9424b1fd-8268-48ab-b80b-25cc406dcfd4 | 7 | public ArrayList<KeyHolder> makeNextSetOfKeys()
{
ArrayList<KeyHolder> keys = new ArrayList<KeyHolder>();
for(int ii =0; ii< 26; ii++)
for(int jj =0; jj<26; jj++)
{
if(ii!=jj && (!this.areBothDuds(ii, jj)))
{
String newKey = this.key;
char temp = newKey.charAt(jj);
if(jj!=25)
new... |
dcede19f-2ec9-46b0-be70-f5b1f2c49e4c | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if... |
a662a5d4-3a68-4cef-a92d-501229371634 | 5 | public void printSummary(final PrintWriter out) {
out.println("Instantiated classes:");
final Iterator instantiated = this.liveClasses.iterator();
while (instantiated.hasNext()) {
final Type type = (Type) instantiated.next();
out.println(" " + type.toString());
}
out.println("\nBlocked methods:");
i... |
5db5dce1-71b7-4b38-be59-00dc4ce9bc43 | 2 | private int check_number_2(int n) {
if (user_.theNumberIs(n)) {
return n;
}
if ((n + 1) % sqrt_max_ == 0) {
return -1;
}
return check_number_2(n + 1);
} |
d86d7f61-d7bf-49e2-bb01-e449b7901cc7 | 5 | public void run(){
//open server socket
ServerSocket serv = null;
try {
serv = new ServerSocket(serverPort);
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
}
while(serverAlive){
//liste... |
7501bdac-ce16-4b8a-9594-a03f406936ae | 6 | public static void main(String[] args) {
String[] strings = {"started", "starting", "ended", "ending"};
for (String string : strings) {
if (string.startsWith("st")) {
System.out.printf("\"%s\" starts with \"st\"\n", string);
}
}
System.out.prin... |
074cb329-6e1f-4cb7-ab78-4e878352dbbb | 5 | public BeanIndexer<K> addUnsortedIndex(String property) {
Map<Object, Set<K>> holder = index.get(property);
if (holder != null && !(holder instanceof NavigableMap<?, ?>)) {
return this;
}
if (holder != null) {
removeIndex(property);
}
holder = new HashMap<Object, Set<K>>();
index.put(property, holder);... |
12a9203c-87c5-4fdc-977d-d25970a7851a | 4 | public ArrayList<Double> simulaPerRunReplicati() {
/* Simula fino al numero di job richiesti. */
while (this.getTempiUscita().size() < this.getJobTotali()) {
Event next = this.getCalendar().get_next();
this.setClock(this.getCalendar().get_next_time(next));
switch (ne... |
7b739fdc-53b6-420d-8f23-3743810094e3 | 0 | @Override
public int hashCode() {
return (int) this.user.getId();
} |
ff771acf-4649-416e-9f0d-64867251323a | 1 | protected final void addTriggerListener( Class<? extends TriggerListener> triggerListenerType )
{
doBind( triggerListeners, triggerListenerType );
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.