method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4a358a7b-2b35-44ab-8534-f4b2cb3f73ba | 0 | public synchronized void addFrame(Image image,
long duration)
{
totalDuration += duration;
frames.add(new AnimFrame(image, totalDuration));
} |
04eb74d4-a9e7-4e87-8956-5920144f5561 | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
e630f4b8-d8ec-4c79-b815-c0f8cc721035 | 5 | public void handleStartTag( HTML.Tag t, MutableAttributeSet a,
int pos )
{
if ( t == HTML.Tag.SELECT)
{
Object value = getValueOfAttribute(a, "name") ;
if (value != null)
{
if (value.toString().hashCode() == "systran_lp".hashCode())
{
s... |
12f36b34-4e29-4642-9d6a-c45b2e09db2d | 0 | public Iterator iterator() {
return new BallIterator(this);
} |
ccc2cec3-2c8e-413a-8413-ea661bb33435 | 2 | public void removeNode(final Object key) {
final GraphNode node = getNode(key);
Assert.isTrue(node != null, "No node for " + key);
succs(node).clear();
preds(node).clear();
if (removingNode == 0) {
nodes.removeNodeFromMap(key);
} else if (removingNode != 1) {
throw new RuntimeException();
}
// ... |
23617224-60ae-490c-a486-9ed0c388c8cb | 4 | public boolean fromDocument(Document document) {
boolean result = true;
NodeList serversList = document.getElementsByTagName(C.servers);
NodeList tasksList = document.getElementsByTagName(C.tasks);
for (int i=0; i<serversList.getLength(); i++) {
result = result && servers.fromElement((Element)serv... |
d67d28b9-58f7-4be0-9a21-df2427e330f1 | 3 | String getResourceCamelOrLowerCase(boolean mandatory, String ending) {
String name = getConventionalName(true, ending);
URL found = getClass().getResource(name);
if (found != null) {
return name;
}
System.err.println("File: " + name + " not found, attempting with came... |
fb2ff292-49f1-4df0-9d5e-b8e78892e6f7 | 2 | private void loadSplashes() {
try (BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/splash/splash text"))) {
Icon splashIcon;
String line = null;
while((line = reader.readLine()) != null) {
// Load each screen
splashIcon = new Icon(line);
splashIco... |
f9c526ea-ae83-4417-9ce1-a480a265020c | 2 | public void encode(OutputStream os, BencodeType... values) throws IOException {
if (values != null) {
for (BencodeType value : values) {
value.encode(os);
}
}
} |
d760852d-0489-4653-9445-fc8031b98a23 | 8 | public ListChooserTF(Frame frame, Component locationComp, String labelText,
String title, Object[] data, int initialIndex, String longValue,
String okLabel, String[] inputTextLabel, int[] inputTextMinValue, int[] inputTextMaxValue, int[] inputTextDefaultValues ) {
super(frame, locationComp, labelText, title, da... |
994b9753-34d6-4203-b3f7-a93104ed90cf | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int biggestNum = Integer.MIN_VALUE;
int smallestNum = Integer.MAX_VALUE;
int biggestOddNumber = Integer.MIN_VALUE;
boolean oddNumberFound = false;
while (true) {
int input = sc.nextInt();
if (input == 0) {
break;
}
... |
06999060-b59e-4500-bfcf-76e50b46045f | 8 | public Token run(List<Token> tokens) {
for (Token token : tokens) {
if (token instanceof ValueToken) {
values.push((ValueToken) token);
continue;
}
OperatorToken o = (OperatorToken) token;
if (Operator.OPEN_PARENTHESIS == o.getOper... |
02724efb-b036-4523-b57b-af9a1405f84c | 3 | static void indexStatistic(){
/*record # of entries with different hitting number */
long entryRcord[] = new long[7];
Iterator<Entry<String, long[]>> iter = index.entrySet().iterator();
while(iter.hasNext()){
Entry<String, long[]> entry= iter.next();
long meta[] = new long[M+2];
meta = entry.getValue()... |
ff07cbdd-555b-400a-a011-282f0e084a51 | 1 | public Long getLongItem(String... names) throws ReaderException {
try {
return Long.parseLong(getItem(names).toString());
} catch (NumberFormatException e) {
throw new ReaderException("No key exists with this type, keys: " + _parseMessage(names) + ". In file: " + ConfigurationManager.config_file_path);
}
... |
e9bc504b-5668-423c-b173-145cafb1cd1c | 0 | public Worker () {
//initial settings
results = new String[VALUE_ITERATIONS_NUMBER];
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} |
2b7d9d23-6d19-46ae-81c2-7a698a1f96f6 | 9 | public void init() {
grid = new Cell[8][8];
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
grid[x][y] = new CellImpl(new Point(y, x));
}
}
for (int q = 0; q < 6; q++) {
grid[0][q + 1].setPiece(Checker.WHITE);
grid[7][q + 1].setPiece(Checker.WHITE);
grid[q + 1][0].setPiece(C... |
2ef60025-2cac-434c-bd1f-803ed4a835ee | 3 | private static MobInventory getMobInventory(int invId)
throws SlickException {
QueryExecutor qe = new QueryExecutor();
qe.SendQuery("SELECT * FROM RPG372DB_Inventory WHERE invId='" + invId
+ "'");
if (qe.resultSize() == 0)
return null;
MobInventory mobInv = new MobInventory(null);
int tempId;
for... |
2ec278d4-964c-4366-b46d-847b1bc95c7d | 7 | private JPopupMenu getSelectionPopupMenu() {
JPopupMenu popup = new JPopupMenu("Selection");
// MenuBar -> Selection -> Copy
JMenuItem menuItemCopy = new JMenuItem("Copy");
menuItemCopy.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
copySelection();... |
0e608054-b7ea-47a0-a2ed-4551d2587006 | 6 | public static List getAllRelationsWithPrefix(Module module, boolean localP, String prefix) {
{ Iterator iter = Logic.allNamedDescriptions(module, localP);
List result = List.newList();
String downcasedprefix = Native.stringDowncase(prefix);
{ NamedDescription description = null;
Iterator ... |
3f270191-04b9-4c93-8758-ce1b0df4848f | 2 | public Element toElement(CashOffice cashOffice) {
Element cashOfficeElement = new Element("cashOffice");
List<Seance> seances = cashOffice.getSeances();
for (Seance seance : seances) {
Element seanceElement = new SeanceTranslator().toElement(seance);
Element ticketsElement = new Element("tickets... |
7db026d4-e04e-4942-a067-9fdc85c401f6 | 8 | public void setSelectedTool(Tool tool){
if(tool == Tool.FOREGROUND){
this.toForeground();
return;
}
if(tool == Tool.BACKGROUND){
this.toBackground();
return;
}
if(tool == Tool.EDIT){
this.edit();
return;
}
selectedTool = tool;
for(ToolButton button : toolButtons){
if(button.getTool(... |
96420624-3135-452d-8485-1faf85c73c56 | 1 | public void testSeDurationBeforeEnd_long2() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setDurationBeforeEnd(-1);
fail();
} catch (IllegalArgumentException ex) {}
} |
65ce7bb4-73d0-4a56-bfd7-62a341dfdbd6 | 9 | public String buildConfigStructureAux(NodeList nl, Element element, String path){
String path_aux = path;
String nodeName;
Node node;
NodeList cn;
int cnSize;
List<Node> lst;
int i = 0;
while(nl.getLength() > i){
path=path_aux;
node = nl.item(i);
cn = node.g... |
7cd2900d-67c2-4184-bb3e-8d0734ff42a6 | 6 | public static Proposition findOrCreateFunctionProposition(GeneralizedSymbol predicate, Cons inputarguments) {
{ Proposition proposition = Logic.beginCreatingFunctionProposition(predicate, inputarguments);
Proposition duplicate = ((!Logic.descriptionModeP()) ? Proposition.findDuplicateFunctionProposition(propo... |
26524d70-39c1-4649-aab7-3024e149018a | 1 | protected void demo16() throws IOException, UnknownHostException, CycApiException {
if (cycAccess.isOpenCyc()) {
Log.current.println("\nThis demo is not available in OpenCyc");
}
else {
Log.current.println("Demonstrating usage of the rkfPhraseReader api function.\n");
String phrase = "peng... |
99070b2b-92cd-499d-892d-c275ccc5f6af | 0 | Xpp3Dom createTimeStamp(final Date date) {
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
return createElementWithText("timestamp", dateFormat.format(date));
} |
0c5e538b-3990-43da-bff3-08ec5529386d | 7 | public Set<Unit> collectMinerals(Set<Unit> drones, Set<Unit> minerals) {
// System.out.println("collectMinerals!");
Set<Unit> claimedMinerals = new HashSet<Unit>();
if (drones==null || drones.isEmpty() || minerals==null || minerals.isEmpty()){
return claimedMinerals;
}
for (Unit drone : drones) {
for ... |
1455e2c4-8a61-42dc-90e8-a802c6aa8131 | 1 | @Override
public void addSubProcess(ProductType productType, SubProcess subProcess) {
productType.addSubProcess(subProcess);
tx.begin();
if (em.contains(subProcess)) em.merge(subProcess);
else em.persist(subProcess);
tx.commit();
} |
cad12934-23b8-4e3d-9334-df93651eb225 | 4 | public ArrayList<TreeNode> generate(int start, int end) {
ArrayList<TreeNode> result = new ArrayList<TreeNode>();
if (start > end) {
TreeNode root = null;
result.add(root);
return result;
}
for (int i = start; i <= end; i++) {
ArrayList<T... |
81614690-f21b-4f8b-84f4-9e7573c73b14 | 9 | private void persist(String cubeIdentifier) throws PersistErrorException,
PageFullException, IOException, SchemaNotExistsException,
CubeNotExistsException {
SchemaClientInterface schemaClient = SchemaClient.getSchemaClient();
Schema schema = schemaClient.getSchema(cubeIdentifier... |
7ddb5dbd-66d3-477b-a017-d32c3b6a62e3 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == m_defaultButton) {
m_matrix.initialize();
matrixChanged();
} else if (e.getSource() == m_openButton) {
openMatrix();
} else if (e.getSource() == m_saveButton) {
saveMatrix();
} else if ( (e.getSource() == m_classesFi... |
8a293731-1b9a-45b3-8595-92ab0f364d8d | 4 | private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
// TODO add your handling code here:
if (correo != null) {
int confirma = JOptionPane.showConfirmDialog(this, "¿Seguro que desea eliminar este correo?", "Confirma", JOptionPa... |
effae8ab-8c94-4ed4-992f-623acf9d1070 | 6 | private String seperateField(String temp)
{
String field = "";
for(int i = 1; i <= temp.length(); i++)
{
if(temp.substring(i - 1, i).equals(","))
{
break;
}
else if(temp.substring(i - 1, i).equals(">"))
{
... |
ff2fbee6-72db-4dc4-aa80-9d9bba9f352c | 4 | public static File showSaveDialog(String title) {
final ExtensionFileFilter filter = new ExtensionFileFilter();
JFileChooser Save = new JFileChooser();
JFrame frame = new JFrame();
frame.setIconImage(Program.programIcon);
if (title.compareTo(Tools.getLocalizedString(ActionType.EXPORT.name()
+ ".Name")) ==... |
a46a55b0-72fb-4f51-8dcc-815c32809dbf | 2 | public Node getNode( int id ){
for( Node node : nodes ){
if( node.getID() == id ){
return node;
}
}
return null;
} |
f6efa46b-d558-4807-bf66-291869f1d363 | 3 | public DnDAlternativeVoteResult(List<Vote> votes, Set<Candidate> candidateSet) {
winners = new ArrayList<Option>();
List<String> winnersGUIDs = computeAVResult(votes, 42);
for (String winnerGUID : winnersGUIDs) {
for (Candidate candidate : candidateSet) {
if (winnerGUID.equals(candidate.getGUID())) {
... |
c32347a7-1013-4303-9455-84c549ffd0cf | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
b001f654-fcd6-4713-b4c7-a92fcba3c52a | 0 | public static void main(String[] args) {
ChocolateChip chip = new ChocolateChip();
chip.chomp();
ChocolateChipProtected chipProtected = new ChocolateChipProtected();
chipProtected.chomp();
} |
f3b8f476-686e-4020-8291-b87e471b4ad4 | 3 | public static void startRound(){
round = round + 1;
gui.initialiseRound();
letGen = new LetterGen();
while(howHardCanItBe() == false)
{
letGen = new LetterGen();
}
if(Game.round == 1){
gui.setRoundText("Let's Begin! Round 1");
}
else if(Game.round == 5){
gui.setRoundText("Last Round, Final Chanc... |
a98c96aa-92da-41e7-af9e-8e6d307e3eb2 | 7 | public ArrayList<String> cbEscolhaProjetos(String codDepartamento) throws SQLException {
ArrayList<String> Projeto = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnec... |
56c3547c-dee0-4df1-a04a-8050be604cf1 | 1 | public static void main(String[] args) throws IOException {
StaticDynamicUncertaintyULHSolver solverWithoutADI = new StaticDynamicUncertaintyULHSolver();
StaticDynamicUncertaintyWithADIULHSolver solverWithADI = new StaticDynamicUncertaintyWithADIULHSolver();
ConstantNormalDistributedProblemGenerator problemGenera... |
05116925-58a3-4aed-bb13-6fb8958f1c02 | 8 | protected Collection createCollection(Class destClass) {
if (destClass == List.class || destClass == ArrayList.class) {
return new ArrayList(); // list默认为ArrayList
}
if (destClass == LinkedList.class) {
return new LinkedList();
}
... |
f4699c14-203b-44e6-8a52-05e8100a8a69 | 9 | public void create(Qualificador qualificador) {
if (qualificador.getQualificadorAplicacaoCollection() == null) {
qualificador.setQualificadorAplicacaoCollection(new ArrayList<QualificadorAplicacao>());
}
if (qualificador.getQualificadorProdutoCollection() == null) {
quali... |
39e9e4c3-9e7d-4de9-9b31-b6e9c1fa0d8d | 8 | public void readFields(DataInput in) throws IOException {
String data = new String(in.readLine());
try {
String tokens[] = data.split("[=]|[\\{]|[\\}]|[,]");
if(data.indexOf("Book") != -1 || tokens.length > 0) {
for( int i = 0; i < tokens.length ; i++) {
... |
b5789204-d255-4afc-b561-e3706c393768 | 5 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player player = (Player)sender;
if(commandLabel.equalsIgnoreCase("whois")) {
if(sender.hasPermission("basics.command.whois.self")) {
if(args.length == 0) {
sender.sendMessage(ChatColor.GRAY + "IP: " + playe... |
af026e38-f5d4-4112-a56f-3828983742dd | 5 | public static Integer getNextPort(String listenHostname, String hostname) {
String[] split = pare(listenHostname, hostname);
if(split == null) {
return null;
}
String[] split2 = split[0].split(":");
String portnum;
if(split2.length<=1) {
try {
return Integer.parseInt(split2[0]);
... |
a02fb74d-a3b4-4f13-b9d7-9746caca1be3 | 8 | @Override
public boolean hasNext() {
try {
String tmp;
this.block.delete(0, this.block.length());
do {
tmp = br.readLine();
if (null == tmp)
return false;
if (tmp.contains(" lo ") || tmp.contains(" sit0 "... |
f9b481e2-b672-4363-a997-2d608c479454 | 8 | public void login(boolean reconnect)
{
// ok it is a connection request
name = tf.getText().trim();
// empty username ignore it
if(name.length() == 0)
return;
// empty serverAddress ignore it
String server = tfServer.getText().trim();
if(server.length() == 0)
return;
// empty or inv... |
81821945-6409-4966-98ec-13ff2cc9bc52 | 9 | final Model method1554(boolean bool, int i) {
anInt2796++;
int i_0_ = anInt2792;
int i_1_ = anInt2767;
if (bool) {
i_1_ = anInt2775;
i_0_ = anInt2822;
}
if ((i_0_ ^ 0xffffffff) == 0)
return null;
Model class124
= Class300.createModel(0,
((ItemLoader) (((ItemDefinition) this)
... |
7da8f557-4c83-458f-9d33-9ce4ac347ba8 | 3 | public static <T extends DC> Equality getPhiEqu(Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> done)
{ if(done!=null)
{ if(done.getNext()!=null)
{ return new Equality(done.getFst().fst().snd().delta(done.getFst().snd().snd()).equa().getValue()&&getPhiEqu(done.getNext()).getValue());
}
else
... |
d3f7b8d6-bf60-4749-99a8-fdf646487333 | 5 | private boolean routeBetween(Tile a, Tile b) {
if (a == b) return false ;
//
// Firstly, determine the correct current route.
// TODO: Allow the road search to go through arbitrary Boardables, and
// screen out any non-tiles or blocked tiles?
final Route route = new Route(a, b) ;
final R... |
97bc5b3f-0699-4993-aff5-6f86ee1289ca | 1 | @Override
public void receiveAlert(AIAlert alert, float urgency, Hostility hostility) {
switch(alert) {
case ATTACKED:
priority = 1f;
break;
}
} |
5fca9e3e-2053-4af1-8e74-4c6abefe5871 | 7 | public static void main(String[] args){
if(args.length != 3){
System.out.println("args: id of this server, ip address of another server, ip address of database");
return;
}
Server server = null;
try {
server = new Server(Integer.parseInt(args[0]), "rmi://"+args[2]+":10001/db");
//register server to ... |
6211989b-349e-45c3-b4a6-25796ae62246 | 2 | public void stop(IntBuffer source) {
if(source != null)
if(AL10.alIsSource(source.get(0)))
AL10.alSourceStop(source);
} |
428136fa-c8db-4fcd-b48d-796be6c2bffb | 5 | public Request(Socket socket) {
if(socket == null){
return;
}
try {
InputStreamReader isr = new InputStreamReader(
socket.getInputStream());
BufferedReader brInput = new BufferedReader(isr);
String line = brInput.readLine();
while (line != null && !line.equals(... |
fac17f1d-19cd-4b4e-8e49-127014889408 | 5 | public static void main(String[] args) {
FileReader fr = null;
try {
fr = new FileReader("test2101.txt");
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
SortListMaker slm = null;
try {
slm = new SortListMaker(fr);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
... |
1412117d-5251-487e-a8ff-c15bc1e74ba7 | 9 | Power(String name, int properties, String imgFile, String helpInfo) {
this.name = name ;
this.helpInfo = helpInfo ;
this.buttonTex = Texture.loadTexture(IMG_DIR+imgFile) ;
this.properties = properties ;
} |
a93abc86-7547-4932-8153-01bde19fdb34 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
b49b96ba-3181-4bbe-b3b3-04ccc12bf73e | 7 | private <T, R> Pair<ConvertType, TypeConverter<T, R>> getConvertInfo(T instance, Class<R> targetClass) {
boolean isNull = (instance == null);
if (instance != null && (targetClass.equals(instance.getClass()) || targetClass.isAssignableFrom(instance.getClass()))) {
return new Pair(ConvertType.identity, null);
}... |
5e658a96-dc6c-4e72-9e44-e19bc6b70d99 | 6 | @Test
public void testPlayCvC() {
//fail("Not yet implemented");
RockPaperScissors myRPSgame = new RockPaperScissors();
assertTrue(myRPSgame.playCvC() <=2);
int battleResult=0;
int Zeroes=0, Ones=0, Twos=0, tooBig=0, tooSmall=0;
for(int i=0;i<50;i++){
battleResult=myRPSgame.playCvC();
if (battleR... |
6eb214dd-d367-4074-b75f-5245b0897dd1 | 4 | public boolean arenaStart(Player player, String name) {
if (!this.arenas.containsKey(name)) {
player.sendMessage(ChatColor.RED + this.lang.getString("arenaStart.notContainsKey"));
return true;
}
if (this.games.containsKey(name)) {
if (this.games.get(name).hasPlayers()) {
player.sendMessage(ChatColor... |
33fdf042-f001-48a6-a149-9e47c1d430c1 | 2 | public static void endAllOwnedBy(String owner){
for(ScheduleData data : schedules){
if(data.getOwner().equalsIgnoreCase(owner)) endSchedule(data.getScheduleID());
}
} |
0fcba815-6d69-47a1-9072-35cc170dc621 | 9 | @Override
public Command planNextMove(Info info){
int warning_radius = 300;
int danger_radius = 100;
InfoDetail next_target;
warning_zone = new Ellipse2D.Double((double)(info.getX() - warning_radius/2), (double)(info.getY() - warning_radius/2), warning_radius, warning_radius... |
5af64ddb-f4c7-4a75-9ce2-cc893d583f7a | 7 | @Override
public void run()
{
while(finish == false)
{
//Prüfen ob der PathCollector nioch gebraucht wird
if(System.currentTimeMillis() - time > timeout)
{
stop();
}
//Neuen Weg erkunden
if(Paths.size() < maxpaths)
{
searchNewPath();
}
//Debug
System.out.println("Neue... |
b09c2736-c0dd-43e7-9faa-91566e698c15 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result
+ ((emagResource == null) ? 0 : emagResource.hashCode());
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
result ... |
5aac628c-0f86-4a4a-bd24-cd6db2e6c8fe | 0 | public DisplayMode getCurrentDisplayMode() {
return device.getDisplayMode();
} |
b223072f-f6e3-4d93-a155-5c6f3370ff19 | 6 | public void update(){
move();
action();
checkLasers();
if(health<=0) {
alive = false;
if (this instanceof Minions) {
for(int q=0;q<objects.size();q++){
if(objects.get(q)==parent&&kind==1){
parent.count--... |
a2a92e99-b01d-4de6-858b-67cc64c23816 | 3 | @Override
public void applyEffect(Joueur jou){
jou.setPositionCourante(super.getMonopoly().getCarreau(11));
jou.setToursPrison(4);
if(jou.getLiberationPrison()){
Scanner sc = new Scanner(System.in);
System.out.printf("Vous possédez une carte Libération de Prison. Voul... |
28318914-709f-47d1-92f2-e039dcfb9f0c | 7 | @Override
public Item peekFirstItem()
{
if(packageText().length()==0)
return null;
final List<XMLLibrary.XMLTag> buf=CMLib.xml().parseAllXML(packageText());
if(buf==null)
{
Log.errOut("Packaged","Error parsing 'PAKITEM'.");
return null;
}
final XMLTag iblk=CMLib.xml().getPieceFromPieces(buf,"PAKI... |
081594e5-e94a-4465-ab25-11bb5823ef30 | 2 | public List<Octo> getAll() {
List<Octo> result = new ArrayList<Octo>();
for(EntityBase ent: db.getItems())
{
if(ent instanceof Octo)
result.add((Octo)ent);
}
return result;
} |
211f9c8f-51b6-4003-809a-4c45bdd6a143 | 4 | public void computeIORatio() {
long fInputKeyValuePairsNum = 0;
long fOutputKeyValuePairsNum = 0;
long fInputBytes = 0;
long fOutputBytes = 0;
for(Reducer fr : finishedReducerList) {
Reduce reduce = fr.getReduce();
fInputKeyValuePairsNum += reduce.getInputKeyValuePairsNum();
fOutputKeyValueP... |
5a2bc5b6-e7a8-4047-80e0-b105b98e7b80 | 2 | public static ActiveDeactiveType valOf(Character val) throws Exception {
if (val.equals(Active.getVal())) {
return Active;
} else if (val.equals(Inactive.getVal())) {
return Inactive;
}
throw new Exception("Kode tidak terdaftar");
} |
d739d339-3939-4242-aecc-3c70fcda3d98 | 1 | public static void debug() {
try
{
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
f386f940-93b2-4c17-be1b-0202fac8b24a | 7 | public void merge(Pair p, int ind) {
edges.remove(ind);
/*int xxx = ind;
while (xxx >= 0) {
edges.remove(xxx);
xxx = edges.indexOf(p);
}*/
Iterator<Pair> it = edges.iterator();
while (it.hasNext()) {
Pair n = it.next();
if (p.v2 == n.v1 || p.v2 == n.v2) {
if (p.v2 == n.v1) {
int has = e... |
a6775b54-f60b-4ba3-82ab-831c8d23d01a | 1 | public void setAvailability(Date dateAt, Object val) {
// check, if date is already existing
RosterAvailability r = checkAvailability (dateAt);
if (r == null) {
rosterAvailability.add(new RosterAvailability (dateAt.getTime(), (int)val));
rosterChangeSupport.firePropertyChange("rosterAvailability", null, va... |
8645b92c-ca66-4fb8-a6d2-667899a4e09a | 1 | public static CtMethod wrapped(CtClass returnType, String mname,
CtClass[] parameterTypes,
CtClass[] exceptionTypes,
CtMethod body, ConstParameter constParam,
CtClass declaring)
... |
d9b7deee-beb4-4040-83ec-11fd05c520b0 | 9 | static boolean isStandardProperty(Class clazz) {
return clazz.isPrimitive() ||
clazz.isAssignableFrom(Byte.class) ||
clazz.isAssignableFrom(Short.class) ||
clazz.isAssignableFrom(Integer.class) ||
clazz.isAssignableFrom(Long.class) ||
... |
58959b70-7394-45e4-b69c-fcb7c1ec198f | 2 | public static String getConcatedString(ArrayList<String> strings) {
String retString = new String();
for (int i = 0; i < strings.size(); i++) {
if (i > 0)
retString = retString + "&&&";
retString = retString + strings.get(i);
}
return retString;
} |
39720c31-12ec-4f3f-b973-e9e8fb04a4c1 | 1 | @Override
public void show(){
for (T item : getHistogram().keySet()) {
System.out.println(item + " " + getHistogram().get(item));
}
} |
806af72f-362b-43fe-b850-f362bc23a6ef | 2 | @Override
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
return null;
} |
c1dbe3f4-d5e8-4a4a-a35d-3504e44beb84 | 3 | public void AddChild(int id, int i, RoomItem Child)
{
if (i < 1)
{
for (int i_ = 0; i_ < MAX_CHILDS_PER_WIRED; i_++)
{
Items[id][i_] = null;
}
}
if (Child == null) return;
Items[id][i] = Child;
ItemOriginal_ExtraDat... |
63727c60-7257-48fa-bc59-080cb7b435f2 | 5 | public String sellStock(Stock st, int numShares){
portfolio = qs.qsort(portfolio, 0); // 0 sorts by ticker name, handy when printing
int index = -1;
// check if they already own some shares in that stock
String searchedTicker = st.getTicker();
// traverse until ticker is found in portfolio
for (int i = 0; i < po... |
384f13b7-c68d-46cd-853b-8e394e13033c | 5 | public String buscarClientePorFecha(String fecha){
//##########################CARGA_BASE DE DATOS#############
tablaDeClientes();
//##########################INGRESO_VACIO###################
if(fecha.equals("")){
fecha = "No busque nada";
return resultBu... |
4b7a9513-30a1-4091-972a-da3042b99915 | 0 | public static void main(String[] args)
{
FrameWithPanel frame = new FrameWithPanel("This is Frame With Panel !");
Panel panel = new Panel();
frame.setSize(200, 200);
frame.setBackground(Color.BLUE);
frame.setLayout(null);
panel.setSize(100, 100);
panel.setBackground(Color.CYAN);
frame.add(p... |
1d531d5c-59f7-4f17-b800-750e0d597881 | 8 | final public Expression IntExpression() throws ParseException {
final Variable v;
final String s;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
v = Variable();
{if (true) return new VariableExpression(v);}
break;
case STRING_END:
case INTEGER:
ca... |
5808aba7-09d1-4775-94fa-b9100657bbcd | 5 | public long Problem3() {
long n=Long.parseLong("600851475143");
long maior=0;
while(n!=1) {
int i=2;
while (i<=n) {
if (Utility.isPrime(i) && n%i==0) {
if (i>maior) {
maior = i;
}
n/=i;
break;
}
i++;
}
}
return maior;
} |
a5229828-957b-405e-ac38-8bb9947aed00 | 0 | @Override
public boolean isConverted() {
// TODO Auto-generated method stub
return false;
} |
7901b0e6-3f5f-4f1b-8684-38b562d26ca9 | 1 | public AbstractTab() {
createContent();
Settings s = Settings.getInstance();
timestampFormat = "";
if ( s.isViewEnabled("timestamp-enabled") )
timestampFormat = s.getViewTimestampFormat();
isChatLoggingEnabled = s.isEventEnabled("log-chat");
} |
38bf9daf-76ee-4fef-ad9e-3164160cad5c | 4 | public static void reverse(int[] arr, int from, int to){
//determine the number of swaps
int iters=0;
if(from>to){
iters=((arr.length-from)+to+1)/2;
} else {
iters=(to-from+1)/2;
}
//do the swaps
while(iters>0){
swap(arr,from,to);
iters--;
//update indexes
from++;
to--;
//check for... |
66888a4e-7497-47cd-b121-efc989789bd4 | 1 | @SuppressWarnings("deprecation")
public void testConstructor_RP_RP_PeriodType5() throws Throwable {
YearMonthDay dt1 = null;
YearMonthDay dt2 = null;
try {
new Period(dt1, dt2, PeriodType.standard());
fail();
} catch (IllegalArgumentException ex) {}
} |
027d5a7c-ccbb-4bea-8922-9d3c8d1a759a | 3 | public String toString(){
String str = (aluno != null ? aluno.toString() : "");
str += (getMedia() != null ? " " + getMedia().toString() : "");
str += (getSituacao() != null ? " " + getSituacao() : "");
return str;
} |
f78e0829-a942-44d7-adf2-ebf9af8b4c81 | 6 | public TableModel obtenerResumenMembresiasDB(int ano, String mes) {
Connection conn = null;
Statement stmt = null;
String query = "SELECT TC.IDCLIENTE, NOMBRE, FECHA_INICIO, DURACION, "
+ "DESCRIPCION, PRECIO FROM GYMDB.CLIENTES TC JOIN "
+ "GYMDB.MEMBRESIAS AS TM... |
442dcbc5-f36f-4caa-a684-bf237cbe5206 | 7 | final void method80(int i) {
if (Class184.aBoolean2469)
Class318_Sub1_Sub2.writeScriptSettings(i + -110);
anInt5170++;
Class59_Sub1_Sub1.method556(false);
if (Class348_Sub8.currentToolkit != null)
Class348_Sub8.currentToolkit.destroy();
if (Class34.aFrame476 != null) {
LoadingStage.method527(Class34... |
ee9bc807-48dd-4731-810c-bfdc2dd93758 | 2 | @Override
public String toString() {
if (reversed) {
reverse();
}
Element tmp = firstElement;
String result = "";
while (tmp != null) {
result += tmp.getValue() + " ";
tmp = tmp.getNextElement();
}
return result;
} |
68208bb2-8e8a-4b53-9c45-2845bc3b4b2e | 8 | public boolean containsTree(Node<T> root, Node<T> otherRoot) {
if(root ==null || otherRoot ==null){
return false;
}
if(root.data.compareTo(otherRoot.data)==0){
if(matchTree(root,otherRoot,false)){
return true;
}
}
if(root.left!=... |
41bb46c8-fdd3-46b1-a4ad-053a83c2c382 | 2 | public Point getRoute(int x, int y)
{
if (thread != null) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return route[y][x];
} |
3c986af1-b8a6-490d-a5c9-c6eeb4c381f4 | 0 | public void makeInactive() {
this.setBorder(BorderFactory.createEmptyBorder());
this.setDefaultBackgroundColor();
} |
2592b19d-2ced-4fe5-a0ad-d1e3075531ae | 0 | public static boolean mouseButtonState(int button) {
return mouseState[button - 1];
} |
f66eb803-27cf-4c5e-a77f-a7cf52676a04 | 8 | private void forward(int[] sequence, double[][] fwd, double[] scaling) {
int T = sequence.length;
int S = this.getNumberOfStates();
double[] pi = this.pi;
double[][] a = this.a;
double[][] b = this.b;
// 1. Initialization
scaling[0x00] = 0.0d;
for (int i ... |
1433b287-6557-4dfe-be94-b8d57521479a | 1 | public int getPriority() {
return postfix ? 800 : 700;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.